仅供 Python编程语言 学习、实践、交流用!
一、用到的库;
import os
import time
import random
from tkinter import messagebox
二、定义的相关函数;
def generate(ball_max, num): #随机生成球号
ball = random.sample([i for i in range(1, ball_max + 1)], k=num)
ball.sort()
return ball
def make_big_letou(): #大乐透
return generate(35, 5) + generate(12, 2)
def tow_ball(): #双色球
return generate(33, 6) + generate(16, 1)
def getPwd(dict): # 历史开奖数据处理
with open(dict, 'r') as f:
for pwd in f:
yield pwd.strip()
def display1(history): #显示大乐透球号码
global d
t = make_big_letou()[:len(make_big_letou())]
a, b, c, d, e, f, g = t
A = (f'{a:0>2d}' + ' ')
B = (f'{b:0>2d}' + ' ')
C = (f'{c:0>