【发布时间】:2015-07-25 04:46:37
【问题描述】:
您好,我在 python3.4 上使用漂亮的汤来解析 html,但我似乎无法找到正确的代码来正确显示这些 html 标记内的信息。我已经成功地从其他站点解析并提取了信息,但是由于某种原因,当我完成循环以使用此代码显示内容时,空括号会出现 [],就好像没有信息一样。
web=requests.get('https://www.scutify.com/company.aspx?ticker=AAPL')
Info=web.content
Scutify=BeautifulSoup(Info,'html.parser')
price=Scutify.find_all('span',{"id":"latest-price"})
print(price)
for item in price:
print(item.content)
【问题讨论】:
标签: html python-3.x beautifulsoup