程序员老A

[Python 程序员学习] 三级菜单实例
Life is short, I learn Python#!/bin/bash/env python # -*...
扫描右侧二维码阅读全文
30
2019/05

[Python 程序员学习] 三级菜单实例

Life is short, I learn Python

#!/bin/bash/env python 
# -*- coding: utf-8 -*-
# Author:Meleuo
# Blog : heresay.cn

game = {
    '暴雪':{
        '守望先锋':['美','半藏','源氏','黑百合','狂鼠','D.VA ','堡垒','末日铁拳'],
        '魔兽世界':['人类','虫族','魔兽','法师']
    },
    'steam':{
        '绝地求生':['98k','M24','AK47','M762','M16'],
        '古墓丽影·暗影':['步枪','手枪','弓箭','雪橇']
    },
    'wegema':{
        '英雄联盟':['无极剑圣','阿狸','阿木木','亚索','慎'],
        '穿越火线':['奥摩','赛斯','伏尔特','白狼','夜玫瑰']
    }
}
error = 0
print(game['暴雪'].keys())
while True:
    for i in game:
        print(i)
    select1 = input("选择你要进入的平台: ")
    if select1 in game.keys():
        while True:
                for x in game[select1]:
                    print(x)
                print("\033[1;37;33m返回上级菜单请按[b]\033[0m")
                select2 = input("选择你要进入的游戏: ")
                if select2 in game[select1].keys():
                    while True:
                        for x1 in game[select1][select2]:
                            print("\t",x1)
    #            print("\033[1;37;40m033[0m")
                        print("\033[1;37;33m返回上级菜单请按[b]\033[0m")
                        select3 = input(">> >  >   > :")
                        if  select3 == "b":
                            break
                        elif select3 == "q":
                            exit()
                        else:
                                pass
                elif select2 == "b":
                     break
                elif select2 == "q":
                     exit()
                else:
                    continue
    elif select1 == "q":
        exit()
    else:
        print("\033[1;37;33m 不存在改平台\033[0m")
        error += 1
        if error > 4:
            print("\033[1;37;31m 你错的次数太多了,ZZ\033[0m")
            exit()
Last modification:June 13th, 2019 at 01:35 pm

One comment

  1. 下载

    test

Leave a Comment