from concurrent.futures import ThreadPoolExecutor
from threading import current_thread
import time
tp =ThreadPoolExecutor(4)#启动线程个数
def c(i):
print(current_thread().ident)#获取线程id
time.sleep(1)
print(i)
for i in range(20):
ret =tp.submit(c,i)#调用线程池