calss Anmial(object):
count = 0
def_init_(self,name,age):
self.name = name
self.age = age
Animal.count + 1
dog = Animal('wangwang',1)
print(Animal.count)
cat = Animal('mimi',3)
print(Animal.count)
pig = Animal('panpan',1)
print(Animal.count)
calss Anmial(object):
count = 0
def __init__(self,name,age):
self.name = name
self.age = age
Animal.count =Animal.count + 1
dog = Animal('wangwang',1)
print(Animal.count)
cat = Animal('mimi',3)
print(Animal.count)
pig = Animal('panpan',1)
print(Animal.count)
1、calss错了,2、init两侧是双下划线而不是单下划线,3、冒号有可能是中文模式