Skip to content

Instantly share code, notes, and snippets.

@w33tmaricich
Last active March 21, 2016 14:12
Show Gist options
  • Save w33tmaricich/5100529 to your computer and use it in GitHub Desktop.
Save w33tmaricich/5100529 to your computer and use it in GitHub Desktop.
py: download from url
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