Skip to content

Instantly share code, notes, and snippets.

@howyi
Last active August 29, 2015 14:24
Show Gist options
  • Save howyi/9486f40e51832a2ca24f to your computer and use it in GitHub Desktop.
Save howyi/9486f40e51832a2ca24f to your computer and use it in GitHub Desktop.
Save images from URL
#Python 3.4.3
import sys
import urllib
def getImage(save_directory,url):
img = urllib.request.urlopen(url)
localfile = open(save_directory + url[url.rfind('/')+1:], 'wb')
localfile.write(img.read())
img.close()
localfile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment