parallel.futures.ThreadPoolExecutor未下载所有数据

问题描述

我正在使用python threadpoolexecutor下载PDF,但缺少一些数据。它不会下载所有文件

我的代码段是:

with concurrent.futures.ThreadPoolExecutor() as executor:
    executor.map(download,names)

这里下载是用于下载数据的功能名称是所有URL的列表,我正在使用requests模块发出请求。

def download(name):
    r = requests.get(URL + name,timeout = 15)
    if r.status_code == 200:
        with open(name,"wb") as f:
            f.write(r.content)
        print(name)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)