【发布时间】:2019-10-25 15:06:30
【问题描述】:
我正在尝试从这个彩票网站获取数据: https://www.lotterycorner.com/tx/lotto-texas/2019
我要抓取的数据是 2017 年到 2019 年的日期和中奖号码。然后我想将数据转换为列表并保存到 csv 文件或 excel 文件。
如果我的问题无法理解,我深表歉意,因为我是 python 新手。这是我尝试过的代码,但我不知道之后该怎么做
page = requests.get('https://www.lotterycorner.com/tx/lotto-texas/2017')
soup = BeautifulSoup(page.content,'html.parser')
week = soup.find(class_='win-number-table row no-brd-reduis')
dates = (week.find_all(class_='win-nbr-date col-sm-3 col-xs-4'))
wn = (week.find_all(class_='nbr-grp'))
我希望我的结果是这样的:
【问题讨论】:
标签: excel python-3.x csv web-scraping beautifulsoup