安装
pip install bs4
构造beautifulsoup对象
soup=beautifulsoup(text)
搜索元素
x=soup.find('div',class_=)
x=soup.find_all('a',href=)
获取标签内文字和html代码
text=soup.text
html=soup.get_attibute('innerHTML')
2023-12-25 19:53:10
pip install bs4
soup=beautifulsoup(text)
x=soup.find('div',class_=)
x=soup.find_all('a',href=)
text=soup.text
html=soup.get_attibute('innerHTML')