采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
用python3.8.6 执行的时候总是报错
super(Human,self).init(name,age)
TypeError: object.init() takes exactly one argument (the instance to initialize)
class Student(People): # 定义变量 __school = 0 def __init__(self, school, name, age): self.__school = school # 实现父类 super().__init__(name, age) def info(self): # 调用父类的方法 super().show() print('school:', self.__school)
我是这样写的。
super(Student, self)
登录后可查看更多问答,登录/注册
语法精讲/配套练习+思考题/原生爬虫实战
6.3k 7
2.9k 3
2.7k 5
4.6k 22
2.8k 19
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号