# author guo
# _*_ coding: utf-8 _*_
data = {
'北京':{
'昌平':{
'沙河':['老男孩','马哥edu'],
'天通苑':['我爱我家','链家']
},
'朝阳':{
'东直门':['东1','东2'],
'西直门':['西1','西2']
},
'海淀':{
'玉泉路':['小烧饼','航天医院'],
'五棵松':['五棵松体育馆','奥莱成龙影城']
}
},
'山东':{
'青岛':{
'市南区':['大华染厂','青岛啤酒'],
'市北区':['海尔','海信']
},
'济南':{
'市中区':['山东大学','市一高'],
'历下区':['公安局','财政局']
}
},
'河南':{
'郑州':{
'二七区':['金星啤酒','二七塔'],
'郑东新区':['会展中心','七里河']
},
'洛阳':{
'西工区':['洛阳一拖','河科大'],
'老城区':['美食街','丽景门']
}
}
}
run_flag = True
while run_flag:
for i in data:
print(i)
user_choice1 = input("请输入你的选择1>>>")
if user_choice1 in data:
while run_flag:
for i1 in data[user_choice1]:
print('\t',i1)
user_choice2 = input("请输入你的选择2>>>")
if user_choice2 in data[user_choice1]:
while run_flag:
for i2 in data[user_choice1][user_choice2]:
print('\t\t',i2)
user_choice3 = input("请输入你的选择3>>>")
if user_choice3 in data[user_choice1][user_choice2]:
for i3 in data[user_choice1][user_choice2][user_choice3]:
print('\t\t\t',i3)
user_choice4 = input("最后一层,请按b返回或者按q退出!")
if user_choice4 == 'b':
continue
elif user_choice4 == 'q':
run_flag = False
else:
input("输入非法,请重新输入:")
elif user_choice3 == 'b':
break
elif user_choice3 == 'q':
run_flag = False
elif user_choice2 == 'b':
break
elif user_choice2 == 'q':
run_flag = False
elif user_choice1 == 'b':
break
elif user_choice1 == 'q':
run_flag = False
python三级菜单
最新推荐文章于 2024-11-05 15:32:33 发布