TA的每日心情 | 擦汗 7 小时前 |
---|
签到天数: 527 天 连续签到: 4 天 [LV.9]测试副司令
|
1测试积点
问题:
python3 运行super() 报错
- <font face="微软雅黑" size="3">import random as r
- class Fish:
- def __init__(self):
- self.x = r.randint(0,10)
- self.y = r.randint(0,10)
- def move(self):
- self.x -= 1
- print("my site is : " ,self.x,self.y)
- class Shark(Fish):
- def __init__(self):
- super().__init__()
- self.hungry =True
- def eat(self):
- if self.hungry:
- print('My dream is eating everyday!')
- self.hungry=False
- else:
- print('Too much ,Too much!!!')
- shark = Shark() </font>
复制代码
报错TypeError: super() takes at least 1 argument (0 given)
求大神们指点~~~~,super().__init__() 哪有问题呀。。是在python3上运行的。
|
|