天道酬勤,学无止境

警告

BeautifulSoup库未写明解析器警告

from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("http://www.pythonscraping.com/pages/page1.html") bsObj = BeautifulSoup(html.read()) print(bsObj.h1) 代码运行之后警告如下:UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). 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 D:/Python/venv/test8.py. To get rid of this warning, pass the

2021-05-12 12:39:49    分类:博客    beautifulsoup   解析器   警告   爬虫