我需要下载此链接下的所有文件,其中只有郊区名称在每个链接中不断变化
仅供引用 https://www.data.vic.gov.au/data/dataset/2014-town-and-community-profile-for-thornbury-suburb
该搜索链接下的所有文件: https://www.data.vic.gov.au/data/dataset?q=2014+town+and+community+profile
有什么可能吗?
谢谢:)
最佳答案
你可以这样下载文件
import urllib2
response = urllib2.urlopen('http://www.example.com/file_to_download')
html = response.read()
获取页面中的所有链接
from bs4 import BeautifulSoup
import requests
r = requests.get("http://site-to.crawl")
data = r.text
soup = BeautifulSoup(data)
for link in soup.find_all('a'):
print(link.get('href'))
关于python - 下载网站中的所有文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45540860/