1 Star 0 Fork 224

hello-tom/project_25500701

forked from mktime/python-learn 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
learn_thread.py 358 Bytes
一键复制 编辑 原始数据 按行查看 历史
内部项目 提交于 2020-12-27 23:36 . 代码备份
from concurrent.futures import ThreadPoolExecutor, as_completed
import time
import random
pages = [x for x in range(1,20)]
def foo(args):
print(args)
return args
executor = ThreadPoolExecutor(max_workers=10)
tasks = [executor.submit(foo, pagenum) for pagenum in pages]
for future in as_completed(tasks):
ret = future.result()
print(ret)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/hello-tom/python-learn.git
git@gitee.com:hello-tom/python-learn.git
hello-tom
python-learn
project_25500701
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385