线程池进程池
1 from concurrent.futures import ThreadPoolExecutor #多线程 2 from concurrent.futures import ProcessPoolExecutor #多进程 3 import time 4 5 def func(i): 6 print(i) 7 time.sleep(2) 8 9 pool=ThreadPoolExecutor(5) 10 11 for i in range(50): 12 pool.submit(func,i)
❤️ 如果你喜欢这篇文章,请点赞支持! 👍 同时欢迎关注我的博客,获取更多精彩内容!
本文来自博客园,作者:佛祖让我来巡山,转载请注明原文链接:https://www.cnblogs.com/sun-10387834/p/12589286.html