【发布时间】:2020-07-02 19:36:31
【问题描述】:
我正在尝试通过此页面检索股票的“流通股”:
(点击“财务报表”-“简明合并资产负债表(未经审计)(括号内)”)
数据在左行表格的底部,我正在使用漂亮的汤,但在检索份额计数时遇到问题。
我正在使用的代码:
import requests
from bs4 import BeautifulSoup
URL = 'https://www.sec.gov/cgi-bin/viewer?action=view&cik=320193&accession_number=0000320193-20-000052&xbrl_type=v#'
page = requests.get(URL)
soup = BeautifulSoup(page.content, 'html.parser')
rows = soup.find_all('tr')
for row in rows:
document = row.find('a', string='Common stock, shares outstanding (in shares)')
shares = row.find('td', class_='nump')
if None in (document, shares):
continue
print(document)
print(shares)
这不返回任何内容,但所需的输出是4,323,987,000
有人可以帮我检索这些数据吗?
谢谢!
【问题讨论】:
标签: python python-3.x beautifulsoup