UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser

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.

The code that caused this warning is on line 4 of the file G:/PycharmProjects/PythonDemo1/Python3.py. To get rid of this warning, change code that looks like this:

BeautifulSoup(YOUR_MARKUP})

to this:

BeautifulSoup(YOUR_MARKUP, “html.parser”)

markup_type=markup_type))

Process finished with exit code 0
UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser_第1张图片

解决方法:安装html5lib,并import

bsObj = BeautifulSoup(html.read(),"html5lib")

如果不修改,第二次也不会报错,这只是不规范

https://beautifulsoup.readthedocs.io/zh_CN/v4.4.0/

你可能感兴趣的:(error,python)