BeautifulSoup的安装
使用命令行工具安装
输入pip3 install BeautifulSoup
在anaconda中输入一下代码测试是否安装成功
import requests
r=requests.get("http://python123.io/ws/demo.html")
r.text
demo=r.text
from bs4 import BeautifulSoup
soup=BeautifulSoup(demo,"html.parser") #html.parser是一个HTML的
解析器
pint("soup.prettify())#打印soup是否正确
from bs4 import BeautifulSoup
soup=BeautifulSoup("
data
", 'html.parser')