用Python写一个爬虫,爬取双色球开奖记录

好的,下面是一个简单的爬虫代码,它爬取了双色球开奖记录:

import requests
from bs4 import BeautifulSoup

url ="http://kaijiang.500.com/ssq.shtml"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')

records = []
for tr in soup.find_all('tr')[2:]:
    tds = tr.find_all('td')
    date = tds[0].te

你可能感兴趣的:(python,爬虫,开发语言,pycharm,ide)