我安裝了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