python TypeError求助
为什么我抄小甲鱼的程序,结果会是这样呢?>>> class Rectangle:
def _init_(self,x,y):
self.x = x
self.y = y
def getPeri(self):
return (self.x + self.y)*2
def getArea(self):
return self.x * self.y
>>> rect = Rectangle(3,4)
Traceback (most recent call last):
File "<pyshell#11>", line 1, in <module>
rect = Rectangle(3,4)
TypeError: object() takes no parameters init左右两边是两个下划线 BngThea 发表于 2018-1-19 17:14
init左右两边是两个下划线
多谢多谢!!
页:
[1]