zoukankan      html  css  js  c++  java
  • 模拟三级菜单

    exit_flag=False
    data= {
    '北京':{
    "昌平":{
    '沙河':['oldboy','test'],
    '天通苑':['链家房产','我爱我家']
    },
    '朝阳':{
    "望京":['奔驰','陌陌'],
    '国贸':['CICC','HP'],
    '东直门':{'advent','飞信'},
    },
    '海绽':{},
    },
    '山东':{
    "德州":{},
    '青岛':{},
    '济南':{},
    },
    '广东': {
    "东莞": {},
    '常熟': {},
    '佛山': {},
    },
    }
    while not exit_flag:
    for a in data:
    print(a)
    choice =input("请选择进入>>")
    if choice in data:
    while not exit_flag:
    for b in data[choice]:
    print(' ',b)
    choice2 = input("请选择进入2>>")
    if choice2 in data[choice]:
    while not exit_flag:
    for c in data[choice][choice2]:
    print(' ', c)
    choice3 = input("请选择进入3>>")
    if choice3 in data[choice][choice2]:
    while True:
    for d in data[choice][choice2][choice3]:
    print(' ', d)
    choice4=input(("当前访问最后一层,输入y可返回>>"))
    if choice4=='y':
    break
    elif choice4=='q':
    exit_flag==True
    if choice3=='y':
    break
    elif choice3=='q':
    exit_flag==True
    if choice2=='y':
    break
    elif choice2=='q':
    exit_flag==True


    脑子不够用当然只能脚踏实地的做事情!
  • 相关阅读:
    核函数
    主成分分析(PCA)原理详解
    Caffe上用SSD训练和测试自己的数据
    FCN-全卷积网络
    rpc选择标准
    dataserver test code
    数字方舟
    分布式事务
    golang获取数据表转换为json通用方法
    qt for java
  • 原文地址:https://www.cnblogs.com/qtclm/p/9108021.html
Copyright © 2011-2022 走看看