menu={
'河南':{
'郑州':{
'开封':{
'景点':['清明上河园','包公祠','禹王台','天波府'],
'大学':['开封大学','河南大学'],
'美食':['灌汤包']
},
'巩义':{
'景点':['万寿山','康百万','雪花洞','石窟寺'],
'大学':['成功学院','广播电视大学']
}
},
'洛阳':{
'栾川':{
'景点':['龙潭大峡谷','老君山'],
'美食':['牛肉汤','浆面条','肉夹馍']
}
}
},
'江苏':{
'南京':{
'玄武区':{
'景点':['玄武湖','鸡鸣寺','明故宫'],
'美食':['盐水鸭','鸭血粉丝汤']
},
'秦淮区':{
'景点':['夫子庙','中山陵','秦淮河','老门东'],
'学校':['南邮','北航']
}
}
},
'安徽':{}
}
back_flag=False
quit_flag=False
while not back_flag and not quit_flag:
for k in menu:
print(k)
choice=input('选择你去的地方:')
if menu.get(choice):
while not back_flag and not quit_flag:
for k in menu[choice]:
print(k)
choice1=input('选择你去的地方:')
if menu[choice].get(choice1):
while not back_flag and not quit_flag:
for k in menu[choice][choice1]:
print(k)
choice2=input('选择你去的地方:')
if menu[choice][choice1].get(choice2):
while not back_flag and not quit_flag:
for k in menu[choice][choice1][choice2]:
print(k)
choice3=input('选择你去的地方:')
if menu[choice][choice1][choice2].get(choice3):
while not back_flag and not quit_flag:
for v in menu[choice][choice1][choice2][choice3]:
print(v)
choice4=input('没有了,可返回上级菜单或退出:')
if choice4 == 'b':back_flag=True
elif choice4 == 'q':quit_flag=True
back_flag=False
elif choice3 == 'b':back_flag = True
elif choice3 == 'q':quit_flag = True
back_flag=False
elif choice2 == 'b':back_flag = True
elif choice2 == 'q':quit_flag = True
back_flag=False
elif choice1 == 'b':back_flag=True
elif choice1 == 'q':quit_flag = True
back_flag=False
elif choice == 'q':quit_flag = True