Skip to content
Advertisement

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

Advertisement

Answer

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) 
Advertisement