-3

I´m interested in downloading a .jpg file from the Internet. I would like to know a function or anyway that lets me to download files from the python console. So I suppose the way would be more or less in that way:

pythondonwloadfunction(URLofthefile, rootwheresavethedonwloadedfile)
martineau
  • 119,623
  • 25
  • 170
  • 301
Peterstone
  • 7,119
  • 14
  • 41
  • 49

1 Answers1

0
import requests
with open('img.jpg', 'wb') as f:
    f.write(requests.get('<image_url>').content)
Ashoka Lella
  • 6,631
  • 1
  • 30
  • 39