import requests from bs4 import BeautifulSoup

请求 URL

url = 'http://shxy.sanya.edu.cn' res = requests.get(url)

解析 HTML

soup = BeautifulSoup(res.text, 'html.parser')

获取所有 P 标签

p_tags = soup.find_all('p')

遍历所有 P 标签并输出文本

for p in p_tags: print(p.text)

Python 爬取三亚学院社会学院所有 P 标签文本 - 代码示例

原文地址: https://www.cveoy.top/t/topic/nhQb 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录