老铁们这样写有那个地方写的不对吗?请指点
number=0
lists = []
def works():
global lists
global number
for i in range(10):
lists.append(number)
number+=1
if len(lists)==1000:
return lists
if name == 'main':
t=ThreadPoolExecutor(max_workers=100)# 创建100个线程
start=time()
for i in range(100):
f=t.submit(works) # 启动线程干活
if len(f.result())!=0:
for result in f.result():
print(result)
每个线程单独一个list,再将每个list 聚合不就行了