python如何抓取网页文字
下面这段代码是提取网页指定内容用的
import requests from bs4 import BeautifulSoup import re url = "https://xxxxxx.html" html = requests.get(url).text bs = BeautifulSoup(html) users = bs.select('.c-author') for each in users: print(each.text)
推荐学习《python教程》。
来源:PY学习网:原文地址:https://www.py.cn/article.html