Python:三级菜单
来源:互联网 发布:淘宝怎样领取淘金币 编辑:程序博客网 时间:2024/06/05 19:09
exit_flag = False # 标志位的作用
menu = {
"JiangSu": {
"NanJing": ["GuLou", "XuanWu"],
"SuZhou": ["XiangCheng", "WuZhong"]
},
"ShangHai": {
"PuDong": ["ZhangJiang", "TangZhen"],
"JingAn": ["ChangPing", "WuNing"]
}
}
while not exit_flag:
for index, key in enumerate(menu.keys()):
print (index, key)
chice_1 = raw_input("Please choose menu to enter:").strip()
if chice_1.isdigit():
chice_1 = int(chice_1)
key_1 = menu.keys()[chice_1]
while not exit_flag:
for index, key in enumerate(menu[key_1]):
print ("-->", index, key)
chice_2 = raw_input("Please choose menu to enter:").strip()
if chice_2.isdigit():
chice_2 = int(chice_2)
key_2 = menu[key_1].keys()[chice_2]
while not exit_flag:
for index, key in enumerate(menu[key_1][key_2]):
print ("-->-->", index, key)
chice_3 = raw_input("Please choose menu to enter:").strip()
if chice_3.isdigit():
print ("This is the last level.....")
elif chice_3 == 'quit':
exit_flag = True
elif chice_3 == 'back':
break
else:
print ('===========Going to Quit=============')
0 0
- Python:三级菜单
- Python-三级菜单
- python-三级菜单
- python-------------三级菜单
- Python三级菜单大概思路
- Python练习之三级菜单
- Python下三级菜单实现
- Python笔记(五)三级菜单
- Python三级菜单初学->脑残版
- python三级菜单(优化版)
- Python小程序:三级菜单
- python编程实例-三级菜单
- python中用字典实现三级菜单
- 三级菜单
- 三级菜单
- 三级菜单
- 三级菜单
- 三级菜单
- K-core, coreness,betweeness
- 锁
- NCL学习笔记(1)——NCL读取nc文件一个变量存入一个新的nc文件
- Android:EditText限制文字输入
- ZooKeeper原理及使用实例
- Python:三级菜单
- XSS测试用例
- 机器学习(九) - - 模型评估和选择④比较检验
- 【HDU5923 2016CCPC东北地区大学生程序设计竞赛 - 重现赛 B】【并查集 暴力 复杂度计算】Prediction 生效若干条链上的所有边条件下的联通块情况
- java io系列20之 PipedReader和PipedWriter
- 31NextPermutation
- IOS框架研究之SDWebImage的原理以及使用流程
- iOS 报linker command failed with exit code 1 (use -v to see invocation)错
- 设计模式(Design Patterns)