我安装了BeautifulSoup后,每当我在cmd中运行我的Python时,这个警告就会出现。如何摆脱BeautifulSoup用户警告?
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正在努力让你的生活更轻松。听汤。 :) – idjaw
把'soup = BeautifulSoup(html)'的代码改成'soup = BeautifulSoup(html,“html.parser”)'。 –
谢谢大家! :D – jellyfishhuang