麻煩看一下,我哪里不對 python進(jìn)階 4-10定義類方法
class Person(object):
? ? __count = 0
? ? @classmethod
? ? def honw_many(cls):
? ? ? ? return cls.__count
? ? def __init__(self,name):
? ? ? ? self.name=name
? ? ? ? Person.__count=Person.__count+1
? ??
print Person.how_many()
p1 = Person('Bob')
print Person.how_many()
2022-03-24
可能是提交的時(shí)候url地址不對吧。仔細(xì)和下載的源代碼核對一下。while條件是不是while($sum=100)?
2017-07-26
你的代碼第四行def honw_many(cls): 里是how不是honw
2016-08-25
?好吧。how寫成了honw--------