BeautifulSoup([your markup]) to this: BeautifulSoup([your markup], "lxml") 解决未设置默认解析器的错误

147 阅读1分钟

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

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

`

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

bsObj = BeautifulSoup(html,'lxml')

即可