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()
Original: https://www.cnblogs.com/outsrkem/p/13934039.html
Author: Outsrkem
Title: Python 多线程
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/578477/
转载文章受原作者版权保护。转载请注明原作者出处!