#Author:ge jian
data = {
'北京':{
'昌平':{
'沙河':['oldboy','test'],
'天通苑':['链家','我爱我家']
},
'朝阳':{
'望京':['奔驰','陌陌'],
'国贸':['CICC','HP'],
},
}
}
exit_flag = False
while not exit_flag:
for i in data:
print(i)
choice = input('选择输入1》》:')
if choice in data:
while not exit_flag:
for j in data[choice]:
print('\t',j)
choice1 = input('选择输入2》》:')
if choice1 in data[choice]:
while not exit_flag:
for k in data[choice][choice1]:
print('\t\t', k)
choice2 = input('选择输入3》》:')
if choice2 in data[choice][choice1]:
for l in data[choice][choice1][choice2]:
print('\t\t',l)
choice3 = input('最后一行,按b退出')
if choice3=='b':
pass
elif choice3=='q':
exit_flag = True
if choice2 == 'b':
break
elif choice2 == 'q':
exit_flag = True
if choice1 == 'b':
break
elif choice1 == 'q':
exit_flag = True
else:
exit_flag = True
转载于:https://www.cnblogs.com/gejian1991/p/8372609.html