【发布时间】:2019-05-16 10:34:41
【问题描述】:
我正在尝试获取a href 下的链接以及下一个<td scope = "raw"> 中可用的文本
我试过了
url = "https://www.sec.gov/Archives/edgar/data/1491829/0001171520-19-000171-index.htm"
records = []
for link in soup.find_all('a'):
Name = link.text
Links = link.get('href')
records.append((Name, Links))
但是这给了我eps8453.htm 作为文本,因为这是标签<a href> 下的文本。有什么方法可以在标签<td scope = "raw"> 旁边的标签<a href> 中查找文本,即“10-K”
请帮忙!
【问题讨论】:
标签: python-3.x beautifulsoup lxml