我有function
:
def play(id1):
print 'playing', id1
os.system("osascript -e 'tell application \"Spotify\" to play track \"%s\"'" % (id1,))
然后我写了一个循环来生成一个track_id
的列表,并按顺序播放每首对应的歌曲:
for i, song in enumerate(songs):
for track in song:
track = song['tracks'][i]
track_id = track['foreign_id'].replace('-WW', '')
print "%d %-32.32s %s" % (i, song['artist_name'], song['title'])
play(track_id)
time.sleep(3000)
但只有一首歌(列表中的最后一首)正在播放。怎么了?