import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning

requests.packages.urllib3.disable_warnings(InsecureRequestWarning)

saved = []

with open('1.txt') as f:
    urls = f.readlines()
    urls = [url.strip('\n') for url in urls]

for url in urls:
    if url not in saved:
        res = requests.get(url, verify=False)
        with open('1/'+url.split('/')[-1], 'wb') as f:
            f.write(res.content)
            saved.append(url)
            p r i n t(url.strip('\n')[-1], '下载完成')
文章标题:python 读取txt文件内链接并下载
本文地址:https://www.xbbk.top/372.html 转载请注明出处
版权说明:本站内容收集若有侵犯到你的权益,请联系删除,联系方式在网站最下方。
最后修改:2021 年 06 月 01 日 07 : 59 AM
如果觉得我的文章对你有用,请随意赞赏