【发布时间】:2018-04-17 17:18:46
【问题描述】:
我要抓取的文本是标题 123rd Meeting 来自
为此,我使用此代码
import urllib.request #get the HTML page from url
import urllib.error
from bs4 import BeautifulSoup
# set page to read
with urllib.request.urlopen('https://www.bcb.gov.br/en/#!/c/copomstatements/1724') as response:
page = response.read()
# parse the html using beautiful soup and store in variable `soup`
soup = BeautifulSoup(page, "html.parser")
print(soup)
# Inspect: <h3 class="BCTituloPagina ng-binding">123rd Meeting</h3>
title = soup.find("h3", attrs={"class": "BCTituloPagina ng-binding"})
print(title)
但是,命令
print(soup)
既不返回标题:第 123 次会议,也不返回正文:鉴于 .... 目标降低 25 个基点。
【问题讨论】: