def lowEnergy():
tids = []
# get songs by recommendation
results = sp.recommendations(seed_artists = [artist['id']])
#retrieve uris for songs
for track in results['tracks']:
tids.append(track['uri'])
#get audio_features
features = sp.audio_features(tids)
#pick energies
energy = [x['energy'] for x in features]
#here I filter out low energy values
low_energy = [x for x in energy if x < 0.5]
#get track names
track_names = [sp.track(uri)['name'] for uri in tids]
现在我想通过低于 0.5 的能量值过滤掉轨道名称,如下所示:
track name1 - 0.49
track name2 - 0.34
等等。
但我在这里挣扎......我该如何实现这一目标?谢谢