2
回答
python 的 一个新手问题
【寻找人气王】邀新用户免费体验华为云服务,百元话费等你拿!   
class Song(object): def _init_(self, lyrics): self.lyrics = lyrics def sing_me_a_song(self): for line in self.lyrics: print line

happy_bday = Song(["Happy birthday to you",  "I don't want to get sued",  "So I'll stop right there"])

bulls_on_parade = Song(["They rally around the family",  "With pockets full of shells"])

happy_bday.sing_me_a_song()

bulls_on_parade.sing_me_a_song()

这是代码

TypeError: object() takes no parameters

这是错误原因。我刚学实在是找不到哪有问题,求解答

举报
顶部