写一段python代码 用来爬取httpsliansai500com中澳超2023年以来已完成比赛的fid将返回结果打印
import requests from bs4 import BeautifulSoup
url = 'https://liansai.500.com/zuqiu-6796/' response = requests.get(url) soup = BeautifulSoup(response.text, 'html.parser') table = soup.find('table', attrs={'id': 'Table3'}) rows = table.find_all('tr')[1:] fids = [] for row in rows: cells = row.find_all('td') if cells[0].text.startswith('2023'): fid = cells[1].text fids.append(fid)
print(fids)
原文地址: https://www.cveoy.top/t/topic/dxGN 著作权归作者所有。请勿转载和采集!