[问题] thread的args

楼主: q79236 (昕翔)   2019-05-06 02:15:04
我有一个function
def thread_execute_search_a_kanbna_index(kanban):
内容忽略
呼叫的时候使用
search_kanban_index = threading.Thread(target =thread_execute_search_a_kanbna_index ,args = (kanban))
search_kanban_index.start()
会出现
TypeError: thread_execute_search_a_kanbna_index() takes 1 positional argument
but 3 were given
但是只要在args中加上 , 成为
search_kanban_index = threading.Thread(target = thread_execute_search_a_kanbna_index ,args = (kanban ,))
就可以正确运行了
请问原因是什么??
或者可以提供关键字让我google
感谢
作者: thefattiger (LT)   2019-05-06 02:28:00
(kanban,)是只有kanban的tuple,(kanban)就是kanban
楼主: q79236 (昕翔)   2019-05-06 12:35:00
了解了 原来是tuple的部分 感谢

Links booklink

Contact Us: admin [ a t ] ucptt.com