K7

K7Blog

须知少年凌云志 曾许人间第一流.
proton
telegram

双色球驗證中獎python代碼+隨機生成彩票號碼

在之前看過一個行銷號發過這麼一個視頻,在韓國的年輕人目前現狀就是不想結婚不想買房一心躺平,沒事買買刮刮樂萬一中了個大獎又能愉快的躺平了。

踏入社會 6,7 年了,曾經稚嫩的小男孩已經不再年輕,曾經的山盟海誓都變成了錢錢錢還是💰!

於是我打算每天拿幾十塊錢買些彩票,說不定能中個大獎就此躺平(我自認為自己這些年運氣還算不錯,就是賭運不行。。。)

https://img.k7blog.com/i/2023/09/04/pfr33c.webp

隨機生成彩票號碼#

代碼都是 chatgpt 寫的。。

雙色球#

import random
import time

def generate_double_color_balls(num_tickets=5):
    tickets = []
    for _ in range(num_tickets):
        current_time = int(time.time())  # 獲取當前時間戳
        random.seed(current_time)  # 使用當前時間戳作為隨機數種子

        # 生成紅色球號碼,從1到33中隨機選擇6個不重複的號碼
        red_balls = random.sample(range(1, 34), 6)
        # 排序紅色球號碼
        red_balls.sort()
        
        # 生成藍色球號碼,從1到16中隨機選擇1個號碼
        blue_ball = random.randint(1, 16)
        
        tickets.append((red_balls, blue_ball))
    
    return tickets

if __name__ == "__main__":
    num_tickets = 5  # 生成5組雙色球號碼
    tickets = generate_double_color_balls(num_tickets)
    
    for i, (red_balls, blue_ball) in enumerate(tickets, 1):
        print(f"第{i}組雙色球號碼:")
        print("紅色球號碼:", red_balls)
        print("藍色球號碼:", blue_ball)
        print()

福彩 3D#

import random
import time

def generate_fc3d_numbers():
    current_time = int(time.time())  # 獲取當前時間戳
    random.seed(current_time)  # 使用當前時間戳作為隨機數種子
    numbers = [random.randint(0, 9) for _ in range(3)]  # 生成3個0到9之間的隨機數字
    return numbers

if __name__ == "__main__":
    fc3d_numbers = generate_fc3d_numbers()
    print(f"福彩3D號碼:{''.join(map(str, fc3d_numbers))}")

七乐彩#

import random
import time

def generate_qlc_numbers():
    numbers = []
    current_time = int(time.time())  # 獲取當前時間戳
    random.seed(current_time)  # 使用當前時間戳作為隨機數種子

    for _ in range(5):
        # 隨機生成7個不重複的紅球號碼(範圍從1到30)
        red_balls = random.sample(range(1, 31), 7)
        
        # 隨機打亂紅球號碼的順序
        random.shuffle(red_balls)
        
        numbers.append(red_balls)
    return numbers

if __name__ == "__main__":
    qlc_numbers = generate_qlc_numbers()
    for i, red_balls in enumerate(qlc_numbers, start=1):
        print(f"第{i}組七乐彩號碼:")
        print("紅球號碼:", red_balls)
        print()

彩票號碼中獎驗證#

我拿 10 塊錢打 5 組號碼,但是我又懶得自己一個個核對,我也怕萬一我狗屎運中獎我自己核對發現不了。。。

api 申請地址:https://www.mxnzp.com/doc/detail?id=3

import requests

def check_lottery_result(api_url, app_id, app_secret, lottery_code, expect, lottery_no):
    # 構建請求參數
    params = {
        'code': lottery_code,   # 彩票類型
        'expect': expect,       # 彩期號
        'lotteryNo': lottery_no,  # 用戶選擇的號碼
        'app_id': app_id,       # 您的API應用ID
        'app_secret': app_secret  # 您的API應用密鑰
    }

    # 發送GET請求
    response = requests.get(api_url, params=params)

    if response.status_code == 200:
        result = response.json()
        return result
    else:
        print("請求失敗")
        return None

if __name__ == "__main__":
    # API地址
    api_url = "https://www.mxnzp.com/api/lottery/common/check"
    
    # 申請地址:https://www.mxnzp.com/doc/detail?id=3
    app_id = "xxx"
    app_secret = "xxxxxx"

    while True:
        # 用戶選擇的彩票類型
        print("請選擇彩票類型:")
        print("1. 雙色球 (ssq)")
        print("2. 七乐彩 (qlc)")
        choice = input("輸入數字選擇彩票類型(1 或 2): ")

        if choice == "1":
            lottery_code = "ssq"
        elif choice == "2":
            lottery_code = "qlc"
        else:
            print("無效的選擇,請重新輸入")
            continue

        user_input_expect = input("請輸入期號(不含前綴23):")  # 手動輸入期號(不含前綴23)
        
        # 在用戶輸入的期號前面添加 "23"
        expect = "23" + user_input_expect
        
        red_balls = input("請輸入紅球號碼(用空格分隔):").split()  # 手動輸入紅球號碼
        blue_ball = input("請輸入藍球號碼:")  # 手動輸入藍球號碼

        # 構建用戶選擇的號碼
        lottery_no = ",".join(red_balls) + "@" + blue_ball

        # 查詢結果
        result = check_lottery_result(api_url, app_id, app_secret, lottery_code, expect, lottery_no)
        
        if result:
            if result["code"] == 1:
                print("查詢成功")
                print("中獎信息:" + result["data"]["resultDetails"])  # 顯示中獎信息及查詢的號碼
            else:
                print("查詢失敗:", result["msg"])
        else:
            print("查詢失敗")

        another = input("是否繼續查詢?(輸入 y 繼續,其他鍵退出): ")
        if another.lower() != 'y':
            break

最好說一句這些東西不要抱太大希望,娛樂一下即可,並且不要觸碰賭博(不管線上還是線下)

載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。