首页 > 编程语言 > 详细

Python - 脚本中使用了bs4.BeautifulSoup方法,执行时提示如下警告

时间:2020-07-18 22:56:36      阅读:425      评论:0      收藏:0      [点我收藏+]

问题现象:

脚本中使用了bs4.BeautifulSoup方法,执行时提示如下警告:

D:\Program Files\python3\pyworks\getProxy.py:15: 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 15 of the file D:\Program Files\python3\pyworks\getProxy.py. To get rid of this warning, pass the additional argument ‘features="html.parser"‘ to the BeautifulSoup constructor.

 

  proxyList = bs4.BeautifulSoup(proxyHTML.read())

解决方法:

使用时添加html.parser参数

proxyList = bs4.BeautifulSoup(proxyHTML.read(),"html.parser")

Python - 脚本中使用了bs4.BeautifulSoup方法,执行时提示如下警告

原文:https://www.cnblogs.com/shm30/p/13337474.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!