在我安装了BeautifulSoup之后,每当我从命令行运行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")
我不知道为什么会出现这个问题,也不知道如何解决它。
BeautifulSoup([你的标记], "html.parser")
。你已经这样做并查看了输出结果吗?BeautifulSoup试图让你的生活更轻松,听从它的建议吧。 :) - idjawsoup = BeautifulSoup(html)
更改为soup = BeautifulSoup(html, "html.parser")
。 - Remi Guan