Python : Running function in thread does not modify current_thread()

后端 未结 2 1204
天命终不由人
天命终不由人 2020-12-16 23:27

I\'m currently trying to figure out how threads work in python.

I have the following code:

def func1(arg1, arg2):

    print current_thread()
    ...         


        
2条回答
  •  再見小時候
    2020-12-16 23:41

    You're executing the function instead of passing it. Try this instead:

    t1 = threading.Thread(target = func1, args = (arg1, arg2))
    

提交回复
热议问题