安装BeautifulSoup
pip install beautifulsoup4
基本使用
from bs4 import BeautifulSoup
res = requests.get(url)
soup = BeautifulSoup(res.text, 'lxml')
删除标签、属性
# 删除标签
for i in ['style','video']:
[s.extract() for s in soup
安装BeautifulSoup
pip install beautifulsoup4
基本使用
from bs4 import BeautifulSoup
res = requests.get(url)
soup = BeautifulSoup(res.text, 'lxml')
删除标签、属性
# 删除标签
for i in ['style','video']:
[s.extract() for s in soup