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)