网址批量下载图片

encoding: utf-8

import os
a=[]
d http://10.xx.xx.xx/xx_1571030590.jpg (txt内容)
f=open(‘D:/Do/Script .txt’)
line=f.readline()
while 1:
lines = f.readlines(10000000)
if not lines:
break
for line in lines:
a.append(line.split()[1])

f.close()
from urllib.request import urlretrieve
for i,b in enumerate(a):
outpath = ‘D:/DO/test/’ + str(i)+’.jpg’
print(outpath)

urlretrieve(b,outpath)
发布了41 篇原创文章 · 获赞 7 · 访问量 3695

猜你喜欢

转载自blog.csdn.net/weixin_43091087/article/details/103182191