概述
def test_func(id):
for i in range(0,5):
sleep(1)
print('thread %d is running %d' % (id,i))
threads = []
for i in range(0,3):
t = threading.Thread(target=test_func,args=(i,))
threads.append(t)
for t in threads:
t.start()
for t in threads:
t.join()
总结
以上是编程之家为你收集整理的python创建线程示例全部内容,希望文章能够帮你解决python创建线程示例所遇到的程序开发问题。
如果您也喜欢它,动动您的小指点个赞吧