python object takes no parameters
1 class Song(object): 2 def __init__(self,lyrics): 3 self.lyrics = lyrics 4 5 def sing_me_a_song(self): 6 for line in self.lyrics: 7 print line 8 9 happy_bday = Song(["happy birthday to you "," I dont want to get sued","so i'll stop right there"]) 10 11 12 bulls_on_parade = Song(["they rally around the family", 13 "with pocket full of sheells"]) 14 15 happy_bday.sing_me_a_song() 16 bulls_on_parade.sing_me_a_song()
def __init__(self,lyrics):
错误出在这个地方,init前后是两个_下划线,而不是一个