1 Star 0 Fork 237

Gavin/python-learn

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/zombiely/python-learn.git
git@gitee.com:zombiely/python-learn.git
zombiely
python-learn
python-learn
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385