码迷,mamicode.com
首页 > 编程语言 > 详细

python_4

时间:2019-10-27 01:09:57      阅读:84      评论:0      收藏:0      [点我收藏+]

标签:over   ret   hang   false   ipa   input   lis   pad   sha   

三级菜单:

data={
‘Beijing‘:{
‘Changping‘:{
‘shahe1‘:[‘cook1‘,‘book1‘],
‘tiantongyuan1‘:[‘TV1‘,‘IPAD1‘]
},
‘Chaoyang‘:{
‘shahe2‘: [‘cook2‘, ‘book2‘],
‘tiantongyuan1‘:[‘TV1‘,‘IPAD1‘]
},
},
‘Jiangsu‘:{
‘Xuzhou‘:{
‘Suining‘:[‘goverment1‘,‘department1‘],
‘Tongshan‘:[‘goverment2‘,‘department2‘]
},
‘Nanjing‘: {
‘Liuhe‘: [‘goverment1‘, ‘department1‘],
‘Lishui‘: [‘goverment2‘, ‘department2‘]
},
},
}

exit_flag=False

while not exit_flag:
for i1 in data:
print(i1)
choice=input("choose1>>:")
if choice in data:
while not exit_flag:
for i2 in data[choice]:
print("\t",i2)
choice2=input("choose2>>:")
if choice2 in data[choice]:
while not exit_flag:
for i3 in data[choice][choice2]:
print("\t\t",i3)
choice3=input("choose3>>:")
if choice3 in data[choice][choice2]:
while not exit_flag:
for i4 in data[choice][choice2][choice3]:
print("\t\t\t",i4)
choice4=input("Press b to return the last level>>:")
if choice4 == "b":
break
elif choice4=="q":
exit_flag = True
if choice3 == "b":
break
elif choice3 == "q":
exit_flag = True
if choice2 == "b":
break
elif choice2 == "q":
exit_flag = True
elif choice == "q":
exit_flag = True

python_4

标签:over   ret   hang   false   ipa   input   lis   pad   sha   

原文地址:https://www.cnblogs.com/taosun/p/11746134.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!