Py学习  »  Python

在python中使用beautifulsoup获取href URL

user86907 • 3 年前 • 1414 次点击  

我正在尝试从以下url下载所有csv文件: https://emi.ea.govt.nz/Wholesale/Datasets/FinalPricing/EnergyPrices ,但不幸的是,我未能如期成功。以下是我的尝试:

soup = BeautifulSoup(page.content, "html.parser")
market_dataset = soup.findAll("table",{"class":"table table-striped table-condensed table-clean"})
for a in market_dataset.find_all('a', href=True):
    print("Found the URL:", a['href'])

谁能帮帮我吗。如何获取csv文件的所有URL。

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/129416
 
1414 次点击  
文章 [ 1 ]  |  最新文章 3 年前