import urllib2
src_url = "http://www.dwconstir.com/inc/download.asp?FileName=3Q17%20%uC2E4%uC801PT_ENG.pdf"
path = "DEST_PATH" #Folder location where you want to download the file.
response = urllib2.urlopen(src_url)
file = open(path + "document.pdf", 'wb')
file.write(response.read())
file.close()
使用请求
import requests
url = 'http://www.dwconstir.com/inc/download.asp?FileName=3Q17%20%uC2E4%uC801PT_ENG.pdf'
path = "DEST_PATH" #Folder location where you want to download the file.
r = requests.get(url, stream=True)
with open(path + "document.pdf", 'wb') as f:
f.write(r.content)
您正在尝试下载PDF。您可以使用urllib2
样本
使用请求
相关问题 更多 >
编程相关推荐