我有一个全局function
:
def filterBelowThreshold(name, feature, tids, xsongs, **kwargs):
print (name, 'PLAYLIST')
for i, x in enumerate(feature):
if x < value:
track_name = sp.track(tids[i])['name']
xsongs.append(track_name)
print(name, ":", "{} - feature: {}".format(track_name, x))
我想在class
function
中调用它,传递以下参数(其变量在本地声明):
在class function
中,在函数调用之前,我声明以下变量:
energy = [item 1, item2, item3, ...]
tids = []
xsongs = []
全局函数的正确语法是什么?在
测试.py
python test.py
将打印0.65
你已经定义好了,没问题。你面临的问题是什么?在
不应使用
**kwargs
如果使用显式参数value
调用函数,只需使用普通参数:把它叫做
^{pr2}$或者
相关问题 更多 >
编程相关推荐