我想這掌握蟒蛇接力誤差超
In [1]: class Parent:
...: def __init__(self):
...: self.a =10
...: self.b =20
...:
In [3]: class NewParent(Parent):
def __init__self():
super(NewParent,self).__init__()
self.c =30
...:
當我這樣做
In [4]: c = NewParent()
In [5]: c
Out[5]: <__main__.NewParent instance at 0x2c98878>
In [6]: c.a
Out[6]: 10
In [7]: c.b
Out[7]: 20
In [8]: c.c
AttributeError的回溯(最近最後一次通話)在 () - - > 1 cc
AttributeError:NewParent實例沒有屬性'c'
是'init'方法一樣'高清__init__self():'在你的代碼?或者這是這裏的錯字? – 2013-02-09 09:11:48