Last active
August 29, 2015 14:24
-
-
Save howyi/9486f40e51832a2ca24f to your computer and use it in GitHub Desktop.
Save images from URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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