简体   繁体   中英

how to download images via python by taking url form a excel sheet

I have a excel sheet with url of images can I use a python script to download them all? if yes then what will be the code

Try this code,

'''Do pip install requests if requests module was not installed'''
import requests

listUrls = ['https://nandyembedly.herokuapp.com/static/favicon.ico']
for url in listUrls:
    res = requests.get(url).content
    with open(f"{url.split('/')[-1].split('.')[0]}.png",'wb') as f:
        f.write(res) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM