import urllib #imports the urllib library url = 'https://www.spdrs.com/site-content/xls/XOP_All_Holdings.xls' #defining the url where the file we want to download is. destination = 'xop_holdings.xls' #defining the destination where you want the file saved to urllib.urlretrieve(url, destination) #this downloads the file. This function returns a tuple containing the filename and headers.
Saturday, December 13, 2014
How to download a file from the internet
Code
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment