1)规则
https://blog.csdn.net/CareChere/article/details/52315728?
2)检测
https://regex101.com/#javascript
2)使用
四大类型:BeautifulSoup;Tag;NavigableString;Comment
1.转类型 soup = BeautifulSoup(html_doc, 'lxml') 2. 解析数据 # find--返回符合查询条件的 第一个标签对象 result = soup.find(name='p',attrs={"class": "story"}) # find_all--list(标签对象) result = soup.find_all(name='p',attrs={"class": "story"}) # select_one---css选择器 result = soup.select_one('.sister') # select----css选择器---返回list #类选择器 result = soup.select('.sister') #id选择器 result = soup.select('#one') #后代选择器 result = soup.select('head title') #组选择器 result = soup.select('title,.title') #属性选择器 result = soup.select('a[id="link3"]') # 取出标签包裹的内容---list result = soup.select('.title')[0].get_text() # 标签的属性 result = soup.select('#link1')[0].get('href')难易 正则>xpth>bs4
效率 正则>xpth>=bs4
html:前端,用来给用户看
xml: 前端 移动端和后台交互的数据形式
common: 都可以用xpath和bs解析