好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

深入类的属性介绍与使用

在交互式环境中输入:

 1 >>> class A: 2     a=0 3     def __init__(self): 4         self.a=10 5         self.b=100 6  7          8 >>> a=A() 9 >>> a.a10 1011 >>> a.b12 10013 >>> A.a14 015 >>> A.b16 Traceback (most recent call last):17   File "<pyshell#10>", line 1, in <module>18     A.b19 AttributeError: type object 'A' has no attribute 'b'20 >>> 

查看更多关于深入类的属性介绍与使用的详细内容...

  阅读:44次