BeautifulSoup警告: BeautifulSoup([your markup], "html.parser")

初学Python,照 Python网络数据采集 这个本的代码打的时候遇到的一个警告

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 23 of the file /Users/LC/Desktop/python3/TCPUDP/scrapetest.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))

尴尬看不懂,谷歌百度了一下,大概是要设置后面的解析参数,设置为"html.parser"就不会报这个警告了
BeautifulSoup(html.read(), "html.parser")

最终我还是在找到的答案 http://www.jianshu.com/p/e09403f4cd6a

恩,我也顺便学习一下如何写文章?这个大概不算吧

你可能感兴趣的:(BeautifulSoup警告: BeautifulSoup([your markup], "html.parser"))