我在使用 python 3.3.2 版时不断收到此错误,我没有做任何我正在观看 youtube 上的教程并尝试过的东西,但他使用的版本是 2.7
>>> class challee:
def cname(self,name):
self.name = name
def display(self):
return self.name
def say(self):
print("help %s" % self.name)
>>> challee
<class '__main__.challee'>
>>> first = challee
>>> second = challee
>>> first.cname(first,"becky")
>>> second.cname(first,"tony")
>>> first.display()
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
first.display()
AttributeError: type object 'challee' has no attribute 'display'