[英]Downloading and renaming images using python
I am trying to download and rename images from a from a website using this code-我正在尝试使用此代码从网站下载和重命名图像-
import pandas as pd
import requests
df = pd.read_excel("images.xlsx")
data = df.to_dict()
for i in range(0, len(data['ITEMS'])):
try:
for url in data['IMAGES'][i].split(","):
ext = "." +data['IMAGES'][i].split(".")[-1]
r = requests.get(url, allow_redirects=True)
open(data['ITEMS'][i]+ext, 'wb').write(r.content)
continue
except:
continue
But it is not downloading and renaming但它不是下载和重命名
Here is one images link I am sharing, of that website- Image这是我分享的那个网站的一个图片链接—— 图片
And for other websites it is working.对于其他网站,它正在运行。
Please tell me why it is not working on this website and what is the solution for this请告诉我为什么它不能在这个网站上运行以及解决方案是什么
Thank you谢谢
I tried to access your link with a browser but it doesn't work, fix it and make sure that it is accessible before trying to download resources using python.我尝试使用浏览器访问您的链接,但它不起作用,修复它并确保在尝试使用 python 下载资源之前可以访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.