线程池模块thernd

from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutor
import time

def task(i):
    print(i)
    time.sleep(1)

pool = ThreadPoolExecutor(10)
for index in range(66):
    pool.submit(task,index)

print('end')

 

posted @ 2017-06-05 14:01  李瑞鑫  阅读(160)  评论(0编辑  收藏  举报