python大乐透_python 获取大乐透中奖结果

# -*- coding:utf-8 -*-# Author:

# @Time:2019-08-05 10:08import os

import sys

import caipiao

import send_mail

def win_rules(num_list,last_results):

my_blue= num_list[0:5]

my_red= num_list[5:]

result_blue= last_results[0:5]

result_red= last_results[5:]

same_blue= [l for l in my_blue if l inresult_blue]

same_red= [l for l in my_red if l inresult_red ]

same_num_blue=len(same_blue)

same_num_red=len(same_red)

subject="大乐透中奖查询"content="未中奖"#9等奖if same_num_blue == 5 and same_num_red == 2:

print("\033[1;31;0m你已经中了一等奖,中奖号码为 %s \033[0m" %num_list)

content= "你已经中了一等奖,中奖号码为" +str(num_list)

elif same_num_blue== 5 and same_num_red == 1:

print("\033[1;35;0m你已经中了二等奖,中奖号码为 %s \033[0m" %num_list)

content= "你已经中了二等奖,中奖号码为" +str(num_list)

elif same_num_blue== 5:

print("\033[1;33;0m你已经中了三等奖, 中奖号码为 %s \033[0m" %num_list)

content= "你已经中了三等奖,中奖号码为" +str(num_list)

elif same_num_blue== 4 and same_num_red == 2:

print("\033[1;32;0m你已经中了四等奖, 中奖号码为 %s \033[0m" %num_list)

content= "你已经中了四等奖,中奖号码为" +str(num_list)

elif same_num_blue== 4 and same_num_red == 1:

print("\033[1;32;0m你已经中了五等奖, 中奖号码为 %s \033[0m" %num_list)

content= "你已经中了一等奖,中奖号码为" +str(num_list)

elif same_num_blue== 3 and same_num_red == 2:

print("\033[1;34;0m你已经中了六等奖, 中奖号码为 %s\033[0m" %num_list)

content= "你已经中了六等奖,中奖号码为" +str(num_list)

elif same_num_blue== 4:

print("\033[1;34;0m你已经中了七等奖, 中奖号码为 %s \033[0m" %num_list)

content= "你已经中了七等奖,中奖号码为" +str(num_list)

elif (same_num_blue== 2 and same_num_red == 2) or (same_num_blue == 3 and same_num_red == 1):

print("\033[1;34;0m你已经中了八等奖, 中奖号码为 %s \033[0m" %num_list)

content= "你已经中了八等奖,中奖号码为" +str(num_list)

elif (same_num_blue== 1 and same_num_red == 2) or (same_num_red == 2) or (same_num_blue == 2 and same_num_red == 1):

print("\033[1;36;0m你已经中了九等奖, 中奖号码为 %s \033[0m" %num_list)

content= "你已经中了九等奖,中奖号码为" +str(num_list)else:

print("sorry,你没有中奖!!!")

content= "未中奖"+ "本次开奖号码为"+str(last_results)

send_mail.mail(subject, content)if __name__ == '__main__':

caipiao.get_winnum()

datepath= datapath = sys.path[0]

fname="lot_500_dlt.txt"fmy_num="my_num.txt"with open(datapath+'/'+ fname,'r') asf:

lines=f.readlines() #读取所有行

last_line= lines[-1].strip('\n')

#获取最新的彩票号码

last_results=last_line.split(",")[1:]

#查询是否中奖,获取自己的号码

with open(datapath+'/'+ fmy_num,'r') asf:

lines=f.readlines()for i inlines:

i=i.strip('\n')

num=i.split(',')

win_rules(num,last_results)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值