标签:end lag previous for lse \n ack any menu
# _*_coding:utf-8_*_
# Author:len liu
menu = {
"四川省":{
"成都市":{
"一区":["一县","二县"],
"二区":["一一县","二二县"]
},
"自贡市":{
"三区":["4县","4.5县"],
"四区":["6县","6.6县"]
} } ,
"浙江省":{
"宁波市":{
"五区":["1县","0县"],
"六区":["22县","23县"]
},
"杭州市":{
"七区":["3县","3县"],
"八区":["4县","4县"]
}},
"广东省":{
"珠海":{
"九区":["5县","6县"],
"拾区":["7县","8县"]
},
"梅州":{
"十一区":["9县","10县"],
"十二区":["11县","12县"]
}
}
}
print("show your province of china:\n")
while True:
for i in menu:
print(i)
choice = input(‘pls input which province of your choice,input "q" for exit:‘).strip()
if choice in menu:
while True:
for c in menu[choice]:
print(c)
choice2 = input(‘pls input which area of your choice or input "b" back to previous menu :‘).strip()
if choice2 in menu[choice]:
while True:
for a in menu[choice][choice2]:
print(a)
choice3 = input(‘pls input which village of your choice or input "b" back to previous menu :‘).strip()
if choice3 in menu[choice][choice2]:
for v in menu[choice][choice2][choice3]:
print(v)
choice4 = input(‘this is end of memu,input any keys back to previous menu,or input "q" exit!:‘).strip()
if choice4 == ‘q‘:
exit()
else:
pass
elif choice3 == ‘b‘:
break
elif choice2 == ‘b‘:
break
elif choice == "q":
break
标签:end lag previous for lse \n ack any menu
原文地址:https://www.cnblogs.com/len1028/p/9262488.html