Python:三级菜单
2016-10-08 16:33
302 查看
exit_flag = False # 标志位的作用 menu = { "JiangSu": { "NanJing": ["GuLou", "XuanWu"], "SuZhou": [" 4000 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=============')
相关文章推荐
- 我的Python成长之路---第一天---Python基础(作业2:三级菜单)---2015年12月26日(雾霾)
- python:编写行政区域三级菜单(day 1)
- python 第一周作业:三级菜单
- Python自动化开发学习之三级菜单制作
- Python三级菜单初学->脑残版
- 使用python实现省市三级菜单效果
- python三级菜单(优化版)
- python三级菜单
- python之三级菜单作业
- python中用字典实现三级菜单
- 使用python实现省市三级菜单效果
- python练习_三级菜单
- python字符串和字典的使用,以及实例三级菜单
- Python下三级菜单实现
- Py修行路 python基础 (五)三元运算 字符编码 元组 集合 三级菜单优化!
- Python 模拟三级菜单
- python三级菜单的代码以及流程图
- Python3 字典及三级菜单练习
- python三级菜单
- Python字典实现简单的三级菜单(实例讲解)