我正在尝试在网页源的特定标签上使用 CSS 选择器。这就是我现在所拥有的:
from bs4 import BeautifulSoup
import requests
import pprint
r2 = requests.get("http://spot311.calgary.ca/reports/15-00462387")
soup = BeautifulSoup(r2.text, 'html.parser')
pprint(soup.select("blockquote"))
在页面源代码中,只有一个名为“blockquote”的标签,但我收到错误消息:
pprint(soup.select("blockquote"))
TypeError: 'module' object is not callable
我用谷歌搜索了一些人,他们只写了一些问题
import BeautifulSoup
代替
from BeautifulSoup import BeautifulSoup
但我已经有了
from bs4 import BeautifulSoup
这对于我的 python 发行版是正确的,我知道因为我有另一个程序使用这个导入并且它工作得很好。
我只是没有使用选择器吗?