Python TypeError: cat() takes no arguments
很少用class 结果今天一个简单的TypeError差点没弄疯
#!/uer/bin/env python3
class cat():
def __init__(self,age,name):
标准的是这样的,结果呢
第一次
#!/uer/bin/env python3
class cat():
def _init_(self,age,name):
看开始中就少了一个下划线
第二次
#!/uer/bin/env python3
class cat():
def __int__(self,age,name):
少了init入口,一直cat() takes no arguments
改后就正常了,class中还是需要细看的哈, takes no arguments就这2个容易犯错的地方