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

python 三级菜单操作

时间:2017-12-18 18:48:31      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:石家庄   print   info   操作   class   菜单   als   美国   返回   

address_info = {
"中国":{
"山西":{
"太原":["小店","迎泽"],
"长治":["长子","长治县"]
},
"陕西":["汉中","咸阳"],
"河北":["石家庄","邯郸"]
},
"美国":{
"纽约":["a","b"],
"迈阿密":["c","d"],
"休斯顿":["e","f"]
}
}
exit_flag = True

while exit_flag:
for i in address_info:
print (i)
choice = input ("选择进入1>>:")
if choice in address_info:
while exit_flag:
for i2 in address_info[choice]:
print ("\t",i2)
choice2 = input("选择进入2>>:")
if choice2 in address_info[choice]:
while exit_flag:
for i2 in address_info[choice][choice2]:
print ("\t",i2)
choice3 = input("选择进入3>>:")
if choice3 in address_info[choice][choice2]:
while exit_flag:
for i3 in address_info[choice][choice2][choice3]:
print("\t", i3)
choice4 = input ("按b返回:")
if choice4 == "b":
break
elif choice4 == "q":
exit_flag = False
if choice3 == "b":
break
elif choice3 == "q":
exit_flag = False
if choice2 == "b":
break
elif choice2 == "q":
exit_flag = False
if choice == "b":
pass
elif choice == "q":
exit_flag = False

python 三级菜单操作

标签:石家庄   print   info   操作   class   菜单   als   美国   返回   

原文地址:http://www.cnblogs.com/wang-rl/p/8057731.html

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