【发布时间】:2019-04-22 11:15:03
【问题描述】:
我正在编写一个 python 程序,使用 BeautifulSoup,它将检索网站上的下载链接。我正在使用 find 方法检索链接所在的 html 类,但它返回 None。
我曾尝试使用父类访问此类,但没有成功。
这是我的代码
link = 'https://data.worldbank.org/topic/agriculture-and-rural-development?view=chart'
for link in indicator_links:
indicator_page = requests.get(link)
indicator_soup = BeautifulSoup(page.text, 'html.parser')
download = indicator_soup.find(class_="btn-item download")
再次,我希望下载链接位于btn-item download html 类中。
【问题讨论】:
-
什么是
indicator_links?
标签: python web-scraping beautifulsoup