首页 > 其他 > 详细

爬虫练手,爬取新浪双色彩,信息并进行分析

时间:2019-07-08 18:57:25      阅读:112      评论:0      收藏:0      [点我收藏+]

爬虫练手,爬取新浪双色彩,信息并进行分析

import requests
from lxml.html import etree



url = 'http://zst.aicai.com/ssq/betOrder/'
response = requests.get(url)
response_html = etree.HTML(response.text)
text_path = '/html/body/div[7]/form/div[2]/table/tbody/tr/td/text()'
data_list = response_html.xpath(text_path)
print(data_list)

count = 0
for a in data_list:
    
    if count == 0: print(f'期号:{a}')
    elif count == 1: print(f'日期:{a}')
    elif count == 2: print(f'出球顺序:{a}',end = '')
    elif count in (3,4,5,6): print(f'{a}',end = '')
    elif count == 7: print(f'{a}')
    elif count == 8: print(f'红球号码:{a}', end='')
    elif count in (9, 10, 11, 12): print(f'{a}', end='')
    elif count == 13: print(f'{a}')
    elif count == 14: print(f'蓝球号码:{a}')

    count += 1
    if count == 15: count = 0

爬虫练手,爬取新浪双色彩,信息并进行分析

原文:https://www.cnblogs.com/pythonywy/p/11152970.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!