Pastebin

Paste #1751: python

< previous paste - next paste>

Pasted by tdn

Download View as text

    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


Do not write anything in this field if you're a human.

Go to most recent paste.