'C' object has no attribute 'FishC'
class C:def __init__(self,name,age):
self.name=name
self.__age=age
def __getattritute__(self,attrname):
if attrname=="FishC":
print("i love fishc")
else:
raise AttributeError(attrname)
实体化 c=C("小甲鱼",18)
调用 c.FishC
出现问题‘C’ object has no attribute ‘FishC’,请大佬帮忙解决 class C:
def __init__(self,name,age):
self.name=name
self.__age=age
def __getattribute__(self,attrname): # getattribute 打错了,b 打成了 t
if attrname=="FishC":
print("i love fishc")
else:
raise AttributeError(attrname)
页:
[1]