Python 多线程
import threading import time def userTest(aa,bb): print(aa) time.sleep(3) print(bb) if __name__ == '__main__': threads = [] # target=执行的函数,args=传给函数的值,range代表打开几个线程执行 for _ in range(33): t = threading.Thread(target=userTest,args=("开始","结束")) threads.append(t) # 打开线程活动 for thr in threads: thr.start() # 等待至线程中止 for thr in threads: thr.join()
作者:Outsrkem
原文链接:https://www.cnblogs.com/outsrkem/p/13934039.html
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。