python object takes no parameters

时间:2024-04-29 03:25:15
 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 dont want to get sued","so i'll stop right there"]) bulls_on_parade = Song(["they rally around the family",
"with pocket full of sheells"]) happy_bday.sing_me_a_song()
bulls_on_parade.sing_me_a_song()

def __init__(self,lyrics):

错误出在这个地方,init前后是两个_下划线,而不是一个