import requests from bs4 import BeautifulSoup url="http://www.gzcc.cn/html/xygk/xrld/" res = requests.get(url) res.encoding="utf-8" soup = BeautifulSoup(res.text,"html.parser") h1 = soup.h1 a = soup.a li = soup.li for i in range(len(li)): liText = soup.li.text print(liText)