pip install beautifulsoup
linux要用 pip3
使用这个网站:https://python123.io/ws/demo.html
# -*- coding: utf-8 -*- """ Created on Tue Jan 21 21:29:56 2020 @author: douzi """ import requests from bs4 import BeautifulSoup r = requests.get("http://python123.io/ws/demo.html") print(r.text) demo = r.text soup = BeautifulSoup(demo, "html.parser") print(soup.prettify())
python爬虫笔记(四)网络爬虫之提取—Beautiful Soup库
原文:https://www.cnblogs.com/douzujun/p/12227172.html