Last active
March 21, 2016 14:12
-
-
Save w33tmaricich/5100529 to your computer and use it in GitHub Desktop.
py: download 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
def download(url): | |
""" | |
Copy a file from a given url to a local file | |
""" | |
import urllib | |
webfile = urllib.urlopen(url) | |
localfile = open(url.split('/')[-1], 'w') | |
localfile.write(webfile.read()) | |
webfile.close() | |
localfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment