04-python3.5-模拟三级菜单-省-县-区域--01
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#Author:XZ data = {
'北京':{
"昌平":{
"沙河":["Oldboy","Test"],
"天通苑":["链家地产","我爱我家"],
"回龙观":["北郊农场","天鸿集团"],
},
"朝阳":{
"望京":["奔驰","陌陌"],
"国贸":["CICC","HP"],
"东直门":["Advent","飞信"],
},
"海淀":{
"西三旗":["清景园","清缘里"],
"中关村":["清华大学","北京大学"],
"五棵松":["310医院","名仕医院"],
},
},
'山东':{
"德州":{},
"青岛":{},
"济南":{},
},
'广东':{
"东莞":{},
"常熟":{},
"佛山":{},
},
}
exit_flag = False
while not exit_flag:
for states in data:
print(states)
user_choice_state = input("请输入选择的省份:>>>")
if user_choice_state in data:
while not exit_flag:
for districts in data[user_choice_state]:
print("\t",districts)
user_choice_district = input("请输入选择的区/县:>>>")
if user_choice_district in data[user_choice_state]:
while not exit_flag:
for areas in data[user_choice_state][user_choice_district]:
print("\t\t",areas)
user_choice_area = input("请输入选择的地段:>>>")
if user_choice_area in data[user_choice_state][user_choice_district]:
for units_list in data[user_choice_state][user_choice_district][user_choice_area]:
print("\t\t\t", units_list)
user_choice_return = input("当前已是末端,如需返回请输入b:>>>")
if user_choice_return == 'b':
pass
elif user_choice_return == 'q':
exit_flag = True
if user_choice_area == 'b':
break
elif user_choice_area == 'q':
exit_flag = True
if user_choice_district == 'b':
break
elif user_choice_district == 'q':
exit_flag = True
04-python3.5-模拟三级菜单-省-县-区域--01的更多相关文章
- Python3 字典及三级菜单练习
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Author;Tsukasa list_1 = { '广州':{ '越秀区':{ '五羊石像','镇海 ...
- python3 实现一个多级菜单小功能
记录下一下 #!/usr/bin/env python3 ''' 需求:三级菜单 三级菜单,依次进入子菜单 ''' City = { '北京':{ '大兴区':[ '亦庄','黄村','中信新城',' ...
- python3 三级菜单
python版本3.5 功能: 1.程序执行显示一级菜单,输入内容进入二级菜单: 2.进入二级菜单后,输入二级菜单内容,进入三级菜单:输入b返回一级菜单: 3.进入三级菜单后,输入b返回二级菜单. # ...
- python 三级菜单 while循环三次,湖北省市-县-街道的选择,3个while的循环 -day2
python编写一个三级while的循环菜单 1.定义字典,字典里面嵌套字典,内嵌字典的值为列表. 思路: 湖北省的市:字典中的定义3个字典,用于存储{序列-键:市名} shiqu_dir = {} ...
- Python3学习之路~2.5 简单的三级菜单程序
程序:三级菜单 需求: 1.打印省.市.县三级菜单2.可返回上一级3.可随时退出程序 代码1: data={ "山东":{ "济南":["历下区&qu ...
- day21 04 三级菜单
day21 04 三级菜单 1.使用递归调用的方法 整体代码类型比较简单如下: menu={'北京':{'海淀':{'a':{},'h':{},'c':{}},'昌平':{'沙河':{},'天通苑': ...
- python3三级菜单的访问,并按q退出
#/usr/bin/env python#yehui'''作业三:多级菜单 三级菜单 可依次选择进入各子菜单 所需新知识点:列表.字典'''import readlineclass MultiLeve ...
- python三级菜单的实现
一.作业要求 1.使用字典实现三级菜单功能 2.直接输入前面数字进入下一级菜单 3.按B返回上一级,按Q退出 二.需要知识点 1.if循环 2.for循环,enumerate的用法 3.while循环 ...
- 我的Python成长之路---第一天---Python基础(作业2:三级菜单)---2015年12月26日(雾霾)
作业二:三级菜单 三级菜单 可一次进入各个子菜单 思路: 这个题看似不难,难点在于三层循环的嵌套,我的思路就是通过flag的真假来控制每一层的循环的,简单来说就是就是通过给每一层循环一个单独的布尔变量 ...
随机推荐
- 报错!!!Servlet.service() for servlet [action] in context with path [/myssh] threw exception [java.lang.NullPointerException] with root cause java.lang.NullPointerException
这个为什么报错啊~~ at com.hsp.basic.BasicService.executeQuery(BasicService.java:33) 这个对应的语句是 Query query = ...
- ECMA Script 6_数值的扩展
1. 二进制 和 八进制 新的表示法 前缀 0b(或0B) 表示 二进制 前缀 0o(或 0O )表示 八进制 console.log(0b111110111 === 503); // true co ...
- Jmeter .jmx 改为.jtl
1.cd $jmeter\bin 2. jmeter -n -t $jmeter\extras\**.jmx -l $jmeter\extras\**.jtl 3.cd $jmeter\extras ...
- JavaScript基础知识(Math的方法)
Math的方法 Math : 对象数据类型 : Math: {} 是window下的一个键值对: 属性名叫Math,属性值是一个对象 var obj = {a:1}; console.log(obj. ...
- Differenciate or distinguish between outlook attachment and embedded image/signature using property accessor in C#.NET
These days, outlook emails are composed in three formats; plain text, html and rtf (rich text format ...
- A股魔咒
4.19魔咒 从2007年开始每逢4月19日大盘大跌. 基金“88”魔咒 88%魔咒,就是当基金的仓位水平达到88%左右的时候,A股市场往往会出现大跌,基金仓位成了股市的“反向指标”,当基金的平均仓位 ...
- Multi-Projector Based Display Code ---- ImageViewer
Overview Image viewer is a typical application for large display. It makes use of the high-resolutio ...
- Ubuntu上hi3531交叉编译环境arm-hisiv100nptl-linux搭建过程
安装SDK 1.Hi3531 SDK包位置 在"Hi3531_V100R001***/01.software/board"目录下,您可以看到一个 Hi3531_SDK_Vx.x.x ...
- 20175303 Mycp实现Linux下cp xxx1 xxx2的功能
20175303 Mycp实现Linux下cp xxx1 xxx2的功能 一.题目要求 编写MyCP2.java 实现类似Linux下cp XXX1 XXX2的功能,要求MyCP2支持两个参数: ja ...
- Vue中import引入模块路径时的@符号
1.ES6 模块主要有两个功能:export 和 import export:用户对外输出本模块(一个文件可以理解为一个模块,比如 aaa.js bbb.js)变量的接口 . import:用于在一个 ...