无法提取' pre'来自网页的标签

时间:2017-12-11 21:10:44

标签: python html web-scraping beautifulsoup webpage

我尝试提取“' pre'中包含的所有范围信息。标签(例如" span class =" n">数据")在' https://www.kaggle.com/arthurtok/interactive-intro-to-dimensionality-reduction/notebook'使用BeautifulSoup,但我无法获得显示的信息。我一直得到"属性错误:' NoneType'对象没有属性'内容'"

以下是我目前使用的代码:

url = 'https://www.kaggle.com/arthurtok/interactive-intro-to-dimensionality-reduction/notebook'
urlRead = urllib.request.urlopen(url).read()
soup = BeautifulSoup(urlRead, 'lxml')
prePrint = soup.find("pre").contents[0]
print(prePrint)

我是否在urlRead中错误地阅读了网页,或者我无法使用BeautifulSoup提取信息?

0 个答案:

没有答案