提取本地网页文本

下面是代码:

path = 'E:/data'
htmlfile = open(path, 'r', encoding='utf-8')
# htmlfile = open(path, 'rb')
htmlhandle = htmlfile.read()
from bs4 import BeautifulSoup
soup = BeautifulSoup(htmlhandle, 'html.parser')
# soup = BeautifulSoup(htmlhandle, 'lxml')

以上就是对提取本地网页文本的认识。

猜你喜欢

转载自blog.csdn.net/CSDN_LYY/article/details/87901782