1 Star 0 Fork 216

andy / 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)
Python
1
https://gitee.com/lianhong_andy/python-learn.git
git@gitee.com:lianhong_andy/python-learn.git
lianhong_andy
python-learn
python-learn
master

搜索帮助