downloading an excel file from the web in python

后端 未结 4 1663
闹比i
闹比i 2020-12-05 09:00

I have the following web address:

dls = \"http://www.muellerindustries.com/uploads/pdf/UW SPD0114.xls\"

I tried to download the file:

4条回答
  •  旧巷少年郎
    2020-12-05 09:27

    This would save the excel file in the same folder that the script was ran from.

    import urllib
    dls = "http://www.muellerindustries.com/uploads/pdf/UW SPD0114.xls"
    urllib.request.urlretrieve(dls, "test.xls")  # For Python 3
    # urllib.urlretrieve(dls, "test.xls")  # For Python 2
    

提交回复
热议问题