机选双色球python程序

作者: mocen_王琪 | 来源:发表于2019-04-30 08:56 被阅读0次

    import random

    redList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
    25, 26, 27, 28, 29, 30, 31, 32, 33]
    blueList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]

    def getNums():
    global redList
    global blueList
    myred = redList
    tempList = []
    for j in range(6):
    # 红球
    tempIndex = random.randint(0, len(myred) - 1)
    a = myred.pop(tempIndex)
    tempList.append(a)
    tempList.sort()
    # 蓝球
    tempList.append(blueList[random.randint(0, len(blueList) - 1)])
    print(tempList)
    with open('numbers.txt', 'a+') as f:
    f.write(tempList.str() + '\n')

    if name == 'main':
    # for i in range(10):
    getNums()

    复制上面的代码,随便找个在线编译python工具运行就行

    相关文章

      网友评论

        本文标题:机选双色球python程序

        本文链接:https://www.haomeiwen.com/subject/hixmnqtx.html