내가 가진이 function
글로벌 :파이썬 - ** kargs을 인수
class
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))
:
filterBelowThreshold('myname', energy, tids, xsongs, value=0.650)
을
내에서 class function
, 함수 호출 이전에 나는 다음 변수를 선언합니다 :
energy = [item 1, item2, item3, ...]
tids = []
xsongs = []
전역 함수에 대한 적절한 구문 무엇?
과 같이 호출 코드가 올바르게 보입니다. 나는 그것에 어떤 문제도 실제로 볼 수 없다 ... – refi64
당신이 쓰려고하는 수업을 보여주세요. 현재 시도를 이해할 수 없습니다. ('kwargs' 처리에 관해서는 도움이된다면'value = 0.650'을'filterBelowThreshold'로 넘겨 주면'kwargs'는 하나의 키 'value'를 갖는'dict'가 될 것입니다. '0.650'). – pistache