Skip to content

Instantly share code, notes, and snippets.

@IanMcT
Created January 21, 2017 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IanMcT/5d65f567df0e6aac493e6fa5c661c8b6 to your computer and use it in GitHub Desktop.
Save IanMcT/5d65f567df0e6aac493e6fa5c661c8b6 to your computer and use it in GitHub Desktop.
Get image from file.
import urllib.request #part of the standard library
#provide the url to open
u = urllib.request.urlopen('https://docs.python.org/3/_static/py.png')
#write the image data to a file
with open('p.png','wb') as f:
f.write(u.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment