【发布时间】:2016-09-06 17:19:49
【问题描述】:
每次我在python中用bs4将soup制作成页面的源代码时,终端都会显示:
/usr/local/lib/python3.4/dist-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html5lib"). 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 229 of the file HibernetBlock.py. To get rid of this warning, change code that looks like this:
BeautifulSoup([your markup])
to this:
BeautifulSoup([your markup], "html5lib")
markup_type=markup_type))
有没有办法避免显示这个?
【问题讨论】:
-
您是否尝试按照警告提示您执行的操作?
-
是的...但在不同的计算机上可能是不同的警告...我需要禁用它。这是可选的。
-
警告是一样的......它只能改变“html5ib”的一部分......仅此而已
标签: python python-3.x beautifulsoup warnings bs4