首页 > 技术文章 > BeautifulSoup([your markup]) to this: BeautifulSoup([your markup], "lxml") 解决未设置默认解析器的错误

fonttian 2017-04-22 13:19 原文

在看时,敲了一些代码,其中报了一个错误为
BeautifulSoup([your markup]) to this: BeautifulSoup([your markup], “lxml”)未设置默认解析器德的错误

`
html = urlopen(“http://en.wikipedia.org“+articleUrl)
bsObj = BeautifulSoup(html)

`

将代码中的 bsObj = BeautifulSoup(html)改为

bsObj = BeautifulSoup(html,'lxml')

即可

推荐阅读