기계는 거짓말하지 않는다

Python Error argument after * must be an iterable, not Queue 본문

Python

Python Error argument after * must be an iterable, not Queue

KillinTime 2022. 6. 10. 22:25

Thread 사용 시 args 매개 변수를 튜플로 전달할 때 오류이다.

튜플로 하나의 매개 변수만 전달 할 시,

 # 오류
 t = threading.Thread(target=custom_function, args=(value1))

아래와 같이 하나의 매개 변수만 전달하더라도 콤마(,)가 필요하다.

# Comma ,
t = threading.Thread(target=custom_function, args=(value1,))

 

Comments