全部版块 我的主页
论坛 提问 悬赏 求职 新闻 读书 功能一区 经管百科 爱问频道
2228 0
2016-03-02
__metaclass__=type#super函数只在新式类中起作用
class bird:
        def __init__(self):
                self.hungry = True
        def eat(self):
                if self.hungry:
                        print 'Aaaah...!'
                        self.hungry=False
                else:
                        print 'No, I`am full!'
class songbird(bird):
        def __init__(self):
                super(songbird,self).__init__()
                self.sound='guaguagua!'
        def sing(self):
                print self.sound
songbird()的代码出现标题中的问题,可是我按照书上抄过来的代码,不知问题出在哪里,我的Python版本是2.7,谢谢

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群