Pastebin
Paste #1751: python
< previous paste - next paste>
Pasted by tdn
def download(self, url, savepath="/tmp/"):
"""Copy the contents of a file from a given URL to a local file."""
webfile = urllib.urlopen(url)
localfile = open( os.path.join(savepath, url.split('/')[-1]), 'w')
localfile.write(webfile.read())
webfile.close()
localfile.close()
New Paste
Go to most recent paste.