File "index.py", line 9 @classmethod ^ IndentationError: unindent does not match any outer indentation level,报错信息,不知道如何解决,请解决下,谢谢!
class Animal(object):
__count=0
def __init__(self,name,age,gender):
self.name=name
self.age=age
self.gender=gender
@classmethod
def set_count(cls):
cls.__count+=1
@classmethod
def get_count(cls):
return cls.__count
dog=Animal('littledog',2,'male')
Animal.set_count()
cat=Animal('littlecat',3,'female')
Animal.set_count()
print(Animal.get_count())