具体是这样的,我有一个类,里面定义了一个列表,
class song(object):
def play(name):
if 'songlist' not in dir():
songlist = [name]
else:
songlist.append(name)
然后我调用这个类,
a = song()
a.play('abc')
但是貌似这样列表一直都是空的,应该怎样定义列表呢?