Python大乐透根据近120期统计随机生成号码

#推荐
Python大乐透根据近120期统计随机生成号码

2026-03-17 2
[!--dianshu--] C币
VIP折扣
    折扣详情
  • 体验VIP会员

    免费

  • 月卡VIP会员

    免费

  • 年卡VIP会员

    免费

  • 永久VIP会员

    免费

查看演示
下载不了?请联系网站客服提交链接错误!
TAG标签: 安装指导

#推荐
Python大乐透根据近120期统计随机生成号码

2026-03-17 php教程 9999 2
郑重承诺丨总裁主题提供安全交易、信息保真!
TAG标签:
安装指导
[!--dianshu--] C币
VIP权限详情
    会员权限详情
  • 体验VIP会员

    免费

  • 月卡VIP会员

    免费

  • 年卡VIP会员

    免费

  • 永久VIP会员

    免费

开通VIP尊享优惠特权
立即下载 等待添加 升级会员 最新活动
微信扫码咨询 微信扫码咨询

联系电话:18888888888

进入TA的商铺 联系官方客服
详情介绍

欢迎!我白天是个邮递员,晚上就是个有抱负的演员。这是我的网站。我住在天朝的帝都,有条叫做Jack的狗。

一段Python自动获取大乐透上一期号码,以及最近120期大乐透号码统计权重随机重号。

import randomimport requests  # 前区规则def generate_numbers():    sections = [(1, 12), (13, 24), (25, 35)]    # 区间比例定义,偶尔出现一次的极端区间比未录入    ratios_options = [[2, 0, 3], [2, 1, 2], [2, 2, 1], [1, 2, 2], [1, 1, 3], [1, 3, 1], [3, 1, 1], [0, 3, 2],                      [0, 2, 3], [2, 3, 0], [3, 2, 0]]    ratios_options_weights = [0.04, 0.13, 0.14, 0.13, 0.06, 0.05, 0.10, 0.06, 0.05, 0.03, 0.05]    ratios = random.choices(ratios_options, weights=ratios_options_weights, k=1)[0]     picked_numbers = []    total_sum = 0     # 奇偶比定义    even_ratio = [(2, 3), (3, 2), (4, 1), (1, 4), (0, 5), (5, 0)]    weights = [0.28, 0.31, 0.20, 0.13, 0.03, 0.05]    odd_even_ratio = random.choices(even_ratio, weights=weights, k=1)[0]    required_odds, required_evens = odd_even_ratio    total_sum_list = [(30, 39), (40, 49), (50, 59),                      (60, 69), (70, 79), (80, 89),                      (90, 99), (100, 109), (110, 119),                      (120, 129), (130, 139)]    total_sum_weights = [0.02, 0.01, 0.08, 0.08, 0.14, 0.13, 0.18, 0.15, 0.15, 0.04, 0.02]    total_sum_result = random.choices(total_sum_list, weights=total_sum_weights, k=1)[0]    start, end = total_sum_result     attempt = 0  # 记录循环次数    while not start <= total_sum <= end or len([num for num in picked_numbers if num % 2 != 0]) != required_odds or len(            [num for num in picked_numbers if num % 2 == 0]) != required_evens:        picked_numbers.clear()        total_sum = 0         if attempt == 1000:  # 如果循环1000次没有符合的数据就跳出            break         for ratio, section in zip(ratios, sections):            for _ in range(ratio):                # 选择奇数或偶数                if len([num for num in picked_numbers if num % 2 != 0]) < required_odds and random.choice(                        [True, False]):                    # 选择奇数                    num = random.choice([n for n in range(section[0], section[1] + 1) if n % 2 != 0])                else:                    # 选择偶数                    num = random.choice([n for n in range(section[0], section[1] + 1) if n % 2 == 0])                 # 确保不重复                while num in picked_numbers:                    num = random.choice([n for n in range(section[0], section[1] + 1) if                                         n % 2 != 0]) if num % 2 != 0 else random.choice(                        [n for n in range(section[0], section[1] + 1) if n % 2 == 0])                 picked_numbers.append(num)                total_sum += num         attempt += 1  # 新增:循环次数加1    return picked_numbers, total_sum, ratios, odd_even_ratio  # 随机后区,一大一小def random_nums():    small_number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]    small_number_weight = [0.10, 0.09, 0.07, 0.06, 0.10, 0.11, 0.08, 0.07, 0.11, 0.08, 0.05, 0.08]     # 选择第一个数    first_number = random.choices(small_number, weights=small_number_weight, k=1)[0]     # 移除第一个数后重新计算权重    updated_weights = [w / (1 - small_number_weight[small_number.index(first_number)]) for i, w in enumerate(small_number_weight) if small_number[i] != first_number]    updated_numbers = [n for n in small_number if n != first_number]     # 选择第二个数    second_number = random.choices(updated_numbers, weights=updated_weights, k=1)[0]     return [first_number, second_number]  def fetch_and_convert_result():    url = "https://webapi.sporttery.cn/gateway/lottery/getHistoryPageListV1.qry?gameNo=85&provinceId=0&pageSize=30&isVerify=1&pageNo=1"    headers = {        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'    }     response = requests.get(url, headers=headers)    response.raise_for_status()  # 确保请求成功     # 解析JSON响应    data = response.json()     # 获取第一个开奖结果    first_result = data['value']['list'][0]['lotteryDrawResult']     # 将开奖结果字符串转换为列表    result_list = [int(num) for num in first_result.split()][:5]     return result_list  # 判断是否有连号def has_consecutive_numbers(numbers):    numbers.sort()  # 对列表进行排序    for i in range(len(numbers) - 1):        if numbers[i] + 1 == numbers[i + 1]:            return True    return False  # 打印符合条件的10组数据list = fetch_and_convert_result()count = 0while count < 10:    try:        numbers, total_sum, ratios, odd_even_ratio = generate_numbers()        has_numbers = has_consecutive_numbers(numbers)        behind = random_nums()        max_value = max(numbers)        min_value = min(numbers)        span = max_value - min_value        # 上期开的号码        # 将列表转换为集合        set1 = set(list)        set2 = set(numbers)         # 计算两个集合的交集,算出重号个数        common_elements = set1.intersection(set2)        repeatlist = [0, 1, 2]        repeatlist_weight = [0.42, 0.48, 0.10]        repeat = random.choices(repeatlist, weights=repeatlist_weight, k=1)[0]        # 重号几个        if len(common_elements) == repeat:            # 是否需要连号,如果需要连号就改成 if has_numbers:            if not has_numbers:                with open('大乐透.txt', 'a', encoding='utf-8') as file:                    print("前区:", sorted(numbers), "后区:", sorted(behind), "和值:", total_sum, "跨度:", span,                          "区间比:",                          ratios, "奇偶比:", odd_even_ratio, "跟上期重号个数:", repeat, file=file)                count += 1    except Exception as e:        pass print("预祝您中奖!!!")print("上期开奖号码:", list)

下载地址
  • 提取密码
  • 1561
  • 解压密码
  • DWQwdewq
    立即免费下载
    Python大乐透根据近120期统计随机生成号码
收藏 (15) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 ()

所有文章为演示数据,不提供下载地址,版权归原作者所有,仅提供演示效果!

CMS主题网 php教程 Python大乐透根据近120期统计随机生成号码 /showinfo-48-309-0.html

我们只做高端Wordpress主题开发!

常见问题
  • 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。
查看详情
  • 最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用
查看详情

相关文章

帝国CMS二次开发 函数文件      PRinterror()/e/class/connect.phpline 132query()/e/class/db_sql.php line 10fetch1()/e/class/db_sql.php line 30fetch()/e/class/db_sql.php line 22checklevel()/e/class/functions.php line 3414insert_dolog()/e/class/functions.php line 3...
#推荐
2026-03-17 14 C币
帝国CMS8.0父子信息调用方      帝国CMS8.0版新增父子信息功能,让一条信息也能成为一个信息、一个栏目、一个专题、甚至一个网站。本文共有四个部分:一、父子信息功能使用流程。二、调用子信息:可以用索引灵动标签调用。三、父子信息列表访问地址的语法说明。四、进阶:调用当前父子信息...
#推荐
2026-03-17 4 C币
帝国CMS判断当前数据库是      有时候我们需要判断数据库是否包含某字段,就可以使用下面这段SQL语法,$fr=$empire-&gt;fetch1(&quot;SELECT COUNT(*) AS column_exists FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = &amp;#39;$infotb&amp;#39; AND COLUMN_NAME = &amp;#39;money&amp;#39;&quot;);if($fr[&amp;...
#推荐
2026-03-17 4 C币
Python开发一个ChatGPT GU      1、首先去下载这个ChatGPT库,用到的库是这个:https://github.com/acheong08/ChatGPT2、安装这个ChatGPT库:pip3 install revChatGPT==0.0.a423、同目录还需要一个“config.json”:{    &quot;session_token&quot;: &quot;&quot;,    &quot;cf_clearance&quot;: &quot;&quot;,    &quot;user_agent&quot;: &quot;
#推荐
2026-03-17 4 C币
使用CSS Grid Generator拖      如果你是CSS小白,不会使用复杂的UI框架,又需要开发一个响应式网站,那么我的站长站推荐你使用CSS Grid Generator,直接拖拽网格,就可以立即生成响应式CSS代码,复制到自己项目即可使用。使用方法1、首先根据你的项目需求,生成指定的列数和网格数量2、然后拖到...
#推荐
2026-03-17 3 C币
Playwright闲鱼智能监控机      项目介绍Playwright闲鱼智能监控机器人项目,基于 Playwright 和AI过滤分析的闲鱼多任务实时监控与智能分析工具,配备了功能完善的 Web 管理界面。可以实时按规则抓取闲鱼商品,垃圾佬的最爱。闲鱼智能监控机器人:https://github.com/dingyufei615/ai-goof...
#推荐
2026-03-17 3 C币
过年给网站加一对灯笼CSS      马上快过年了,给网站加一对红灯笼,这样才有过年的喜庆劲儿。灯笼是代码生成的无需图片,而且还会摆动。使用方法把HTML下面代码粘贴到网页BODY内任意位子都可以。灯笼的位子可以微调.deng-box的left和right数值。CSS代码&lt;!-- 灯笼代码 --&gt;&lt;div class=&quot;de...
#推荐
2026-03-17 3 C币
ajax上传文件进度条功能示      ajax上传文件时,有时比较耗时,需要在界面上显示下进度信息,获取ajaxSettings中的xhr对象,为它的upload属性绑定progress事件的处理函数前端代码&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;&lt;meta charset=&quot;utf8&quot;&gt;&lt;title&gt;test upload&lt;/title&gt;&lt;!--jquery--&gt;&lt;script src=&quot;h...
#推荐
2026-03-17 3 C币