【发布时间】:2021-03-05 06:59:29
【问题描述】:
我有一个函数,它接受字符串类型的多个参数 (* args)。线程如何处理每个接收到的参数。 以下是我的处理方式:
def functionA(x):
print(x)
def functionB(*args):
for ar in args:
th = threading.Thread(target=functionA, args=(ar, ))
th.start()
但它不起作用。帮帮我。
【问题讨论】:
-
你的意思是但它不起作用? ...您的代码运行良好。
-
@MauriceMeyer 是的。但它同步运行(依次),而不是同时运行
-
它正在工作^^。我在写 run() 和 strart() 的时候弄糊涂了。谢谢
标签: python python-3.x function arguments python-multithreading