from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor
from time import sleep
def dd(v):
sleep(1)
print(v)
return v
pool = ThreadPoolExecutor(max_workers=5)
for i in range(10):
f = pool.submit(dd,i)
print(f.result())
网友评论