目录
1.常见引入形式
>>> from bs4 import Beautifulsoup
2.创建Beautiful Soup对象
>>>soup = BeautifulSoup (html)
>>>type (soup)
<class 'bs4.BeautifulSoup'>
3.Beautiful Soup对象的常用属性
title
Strings
stripped
strings
4.查找tag的函数
Find_all(name , attrs , recursive , text , **kwargs )
find( name , attrs , recursive , text, **kwargs )
5.获取tag对象
>>>tag = soup.head.title
>>> tag
<title>Beautiful Soup
Documentation - Beautiful Soup
4.4.0 documentation</title>
6.Tag对象的常用属性
name
attrs
contents
string
7.Tag中数据的获取函数
get(attribute)
get_text()