【发布时间】:2020-02-05 11:02:55
【问题描述】:
我想下载this 链接的压缩文件。我尝试了各种方法,但我无法做到这一点。
url = "https://www.cms.gov/apps/ama/license.asp?file=http://download.cms.gov/Research-Statistics-Data-and-Systems/Statistics-Trends-and-Reports/Medicare-Provider-Charge-Data/Downloads/Medicare_National_HCPCS_Aggregate_CY2017.zip"
# downloading with requests
# import the requests library
import requests
# download the file contents in binary format
r = requests.get(url)
# open method to open a file on your system and write the contents
with open("minemaster1.zip", "wb") as code:
code.write(r.content)
# downloading with urllib
# import the urllib library
import urllib
# Copy a network object to a local file
urllib.request.urlretrieve(url, "minemaster.zip")
谁能帮我解决这个问题。
【问题讨论】:
标签: python python-3.x web-scraping