0
点赞
收藏
分享

微信扫一扫

Python之并行

晚安大世界 2022-07-18 阅读 141

最近比较喜欢的一个并行实现,可以实时查看结果:

from concurrent.futures import ProcessPoolExecutor, as_completed

executor = ProcessPoolExecutor(max_workers=5)
tasks = [executor.submit(run_func, server) for arg in args]

results = {}

for future in as_completed(tasks):
result = future.result()
results.append(result)

 

​​http://www.open-open.com/news/view/1c0179b/​​

黄世宇/Shiyu Huang's Personal Page:​​https://huangshiyu13.github.io/​​



举报

相关推荐

0 条评论