标签:菜单 false 选择 上海 NPU ice 金山 bre dax
data = {
‘中国‘:{
‘北京‘:{
‘朝阳‘:[‘天安门‘,‘人民大会堂‘],
‘昌平‘:[‘八达岭长城‘,‘沙河‘]
},
‘上海‘:{
‘浦东‘:[‘东方明珠‘,‘世纪公园‘],
‘黄浦区‘:[‘外滩‘,‘中共一大会址纪念馆‘]
},
‘香港‘:{
‘九龙半岛‘:[‘旺角‘,‘油麻地‘,‘尖沙咀‘],
‘新界‘:[‘铜锣湾‘,‘香港海洋公园‘,‘香港维多利亚港‘]
},
‘台湾‘:{
‘台北‘:[‘台北故宫‘,‘士林夜市‘,‘台北101大楼‘],
‘高雄‘:[‘六合夜市‘,‘佛光山‘,‘西子湾‘]
}
},
‘美国‘:{
‘纽约‘:{
‘华尔街‘:[‘没去过‘,‘懒得查‘],
‘自由女神像‘:[‘光天化日‘,‘坦胸露乳‘,‘不要脸‘]
},
‘旧金山‘:{
‘湾区‘:[‘听说华人多‘,‘关我什么事‘],
‘硅谷‘:[‘嗯哼!‘,‘吴军的来信‘]
}
},
‘泰国‘:{
‘不了解‘:{
‘大皇宫‘: [‘renyao‘,‘人妖‘],
‘xiaokkk‘: [‘hshdj‘,‘yaoren‘]
},
‘妈卖批‘:{
‘daxiang‘: [‘gzd‘,‘afa‘],
‘sdaf‘:[‘saf‘,‘safa‘]
}
}
}
exit_flag = False
while not exit_flag:
for i in data:
print(i)
choice = input(‘选择进入》》》:‘)
if choice in data:
while not exit_flag:
for i in data[choice]:
print(‘\t‘,i)
choice2 = input(‘选择进入》》》:‘)
if choice2 in data[choice]:
while not exit_flag:
for i in data[choice][choice2]:
print(‘\t\t‘,i)
choice3 = input(‘选择进入》》》:‘)
if choice3 in data[choice][choice2]:
for i in data[choice][choice2][choice3]:
print(‘\t\t‘,i)
choice4 = input(‘最后一层,输入back返回,输入quit退出:‘)
if choice4 == ‘back‘:
pass
elif choice4 == ‘quit‘:
exit_flag = True
if choice3 == ‘back‘:
break
elif choice3 == ‘quit‘:
exit_flag = True
if choice2 == ‘back‘:
break
elif choice2 == ‘quit‘:
exit_flag = True
elif choice == ‘quit‘:
exit_flag = True
偷个懒,不写注释了,反正简单,仔细看看就会懂的!
标签:菜单 false 选择 上海 NPU ice 金山 bre dax
原文地址:https://www.cnblogs.com/hcq-learning/p/8953596.html