标签:进程池 res imp print read sub tor ESS time
###################### 线程池 ############ from concurrent.futures import ThreadPoolExecutor import time def task(arg): print(arg) time.sleep(1) pool = ThreadPoolExecutor(5) for i in range(50): pool.submit(task,i) ################################################# ############################# 进程池 ################# from concurrent.futures import ProcessPoolExecutor import time def task(arg): print(arg) time.sleep(1) if __name__ == ‘__main__‘: pool = ProcessPoolExecutor(3) for i in range(50): pool.submit(task,i)
线程ThreadPoolExecutor与进程ProcessPoolExecutor
标签:进程池 res imp print read sub tor ESS time
原文地址:https://www.cnblogs.com/lhqlhq/p/9246364.html