-2

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
  • 112,593
  • 23
  • 157
  • 280
Peterstone
  • 6,487
  • 14
  • 40
  • 49

1 Answers1

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