headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36', 'Accept-Language': 'zh-CN,zh;q=0.9', }
response = requests.get(url=url,headers=headers) htmlText = response.text soup = bs4.BeautifulSoup(htmlText,"html.parser") newList = soup.find_all("td",attrs={"class":"td-02"}) num = 0 for i in newList[1:]: data = i.contents[1].contents[0] title = i.contents[3].contents[0] num+=1 print(str(num)+"、",data,title)