BeautifulSoup
库
pip install beautifulsoup4
通过定位html标签来格式化和组织复杂的网页源代码,用简单易用的python对象来展示出html结构信息。
- 解析数据
import requests
from bs4 import BeautifulSoup
headers = {
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36'
}
res = requests.get('https://b