Pip install beautifulsoup4
Beautifulsoup4的安装小测
演示HTML页面地址:http://python123.io/ws/demo.html
Beautiful soup
From bs4 import BeautifulSoup
Soup=BeautifulSoup(“<html>data<html>”,”html.parser”)
#可以打开文件进行解析html 代码
Soup2=BeautifulSoup(open(“D://demo.html”),”html.parser”)
获得tag标签的方法:
编译器
源代码 目标代码