|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
>>> class juxing:
def __init__(self,width=0,height=0):
self.width = width
self.height = height
def __setattr__(self,name,value):
if name == 'square':
self.width = value
self.height = value
else:
super().__setattr__(name,value)
def getarea(self):
return self.width*self.height
SyntaxError: inconsistent use of tabs and spaces in indentation
这是什么错误啊。
Tab 与空格混用了,这样试试:
- class juxing:
- def __init__(self, width=0, height=0):
- self.width = width
- self.height = height
- def __setattr__(self, name, value):
- if name == 'square':
- self.width = value
- self.height = value
- else:
- super().__setattr__(name, value)
- def getarea(self):
- return self.width * self.height
复制代码
|
|