请问一下大家这是什么问题
代码如下:
class Animal(object):
__localtion = 'Asia'
__count = 1
def __init__(self, name, age):
self.name = name
self.age = age
Animal.__count += 1
@classmethod
def get_count(cls):
return cls.__count
dog = Animal('wangwang', 1)
cat = Animal('mimi', 3)
pig = Animal('panpan', 1)
print(Aniaml.get_count())
报错如下:
Traceback (most recent call last): File "index.py", line 17, in count = Aniaml.get_count() NameError: name 'Aniaml' is not defined