为了账号安全,请及时绑定邮箱和手机立即绑定

和答案相同,但是无法输出,求大神解释原因

class Person(object):


    __slots__ = ('name', 'gender')


    def __init__(self, name, gender):

        self.name = name

        self.gender = gender


class Student(Person):


    __slots__ = ('score',)


    def __init__(self,name,gender,score):

        super(Student,self).__int__(name,gender)

        self.score=score


s = Student('Bob', 'male', 59)

s.name = 'Tim'

s.score = 99

print s.score




输出结果是

Traceback (most recent call last):
File "index.py", line 17, in 
s = Student('Bob', 'male', 59)
File "index.py", line 14, in __init__
super(Student,self).__int__(name,gender)
AttributeError: 'super' object has no attribute '__int__

正在回答

2 回答

这个错误不应该啊

0 回复 有任何疑惑可以回复我~

super(Student,self).__init__,这里差了一个i

2 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
python进阶
  • 参与学习       255532    人
  • 解答问题       3038    个

学习函数式、模块和面向对象编程,掌握Python高级程序设计

进入课程

和答案相同,但是无法输出,求大神解释原因

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号