class Ball:
def _init_(self, color, size,direction):
self.color = color
self.size = size
self.direction = direction
def _str_(self):
msg = "Hi, I'm a " + self.size + "" +self.color + "ball!"
return msg
myBall = Ball("size", "small", "down")
print myBall运行时提示出错:Traceback (most recent call last):
File "C:/Python27/dfkjdk.py", line 11, in <module>
myBall = Ball("size", "small", "down")
TypeError: this constructor takes no arguments
帮忙看看有什么地方写错了。
ST菜煎饼
何苦虐人心
随时随地看视频慕课网APP
相关分类