小编jel*_*ang的帖子

如何摆脱BeautifulSoup用户警告?

安装BeautifulSoup之后,每当我在cmd中运行我的Python时,就会出现这个警告.

D:\Application\python\lib\site-packages\beautifulsoup4-4.4.1-py3.4.egg\bs4\__init__.py:166:
UserWarning: No parser was explicitly specified, so I'm using the best
available HTML parser for this system ("html.parser"). 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.

To get rid of this warning, change this:

 BeautifulSoup([your markup])

to this:

 BeautifulSoup([your markup], "html.parser")
Run Code Online (Sandbox Code Playgroud)

我没有理解为什么它出来以及如何解决它.

python beautifulsoup user-warning

41
推荐指数
4
解决办法
5万
查看次数

标签 统计

beautifulsoup ×1

python ×1

user-warning ×1