Last active
April 10, 2023 23:43
-
-
Save oculushut/193a7c2b6002d808a791 to your computer and use it in GitHub Desktop.
Example for using Python to download file
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 2 | |
#import urllib | |
#url = "https://www.cs.cmu.edu/~./enron/enron_mail_20150507.tgz" | |
#urllib.urlretrieve(url, filename="../enron_mail_20150507.tgz") | |
#print "download complete!" | |
##Python 3 | |
import urllib.request | |
url = "https://www.cs.cmu.edu/~./enron/enron_mail_20150507.tgz" | |
print ("download start!") | |
filename, headers = urllib.request.urlretrieve(url, filename="e:\\PythonStuff\\enron_mail_20150507.tgz") | |
print ("download complete!") | |
print ("download file location: ", filename) | |
print ("download headers: ", headers) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment