Beautiful Soup报错处理
作者:互联网
1、报错内容:
GuessedAtParserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.
The code that caused this warning is on line 11 of the file F:/爬虫/test01.py. To get rid of this warning, pass the additional argument 'features="lxml"' to the BeautifulSoup constructor.
bsObj = BeautifulSoup(content.read())
原因:beautiful soup运行时没有指定的解释器
解决:
bsObj = BeautifulSoup(content.read(), 'html5lib')
html5lib 安装方式:pip install html5lib
标签:Beautiful,code,parser,BeautifulSoup,Soup,warning,报错,html5lib 来源: https://www.cnblogs.com/spritegirl/p/14821252.html