我正在使用numpy和Spotipy来检索我的播放列表。这是我遇到的代码
def get_features_for_playlist(uri):
playlist_id = uri.split(':')[2]
results = sp.user_playlist(username, playlist_id)
它一直在给我错误
NameError: name 'sp' is not defined
有人可以帮助我吗?我尝试搜索详细文档,但显示的是我在此处使用的相同代码。
答案 0 :(得分:1)
确保您输入:
sp = spotipy.Spotify()
答案 1 :(得分:0)
根据错误,尝试添加:
from spotipy import Spotify as sp
作为代码的第一行,它看起来不像您导入的spotipy
。