BeautifulSoup库的标签理解

**1BeautifulSoup库的引用和标签含义**
<p class ="title">...</p>:
<p>...</p>:标签Tag,一般是成对出现的
class="title":属性Attributes,由0个或者多个键值对构成的
BeautifulSoup 常用的引用的方式:
from bs4 import BeautifulSoup

2BeautifulSoup的解析器

解析器 使用方法 条件
bs4的HTML解析器 BeautifulSoup(mk,‘html.praser’) 安装bs4库
lxml的HTML解析器 BeautifulSoup(mk,‘lxml’) pip install lxml
xml的HTML解析器 BeautifulSoup(mk,‘xml’) pip install xml
html5lib的解析器 BeautifulSoup(mk,‘html5lib’) pip install html5lib

3BeautifulSoup类的基本元素
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/shine10076/article/details/84031725