address_info = {
"中国":{
"山西":{
"太原":["小店","迎泽"],
"长治":["长子","长治县"]
},
"陕西":["汉中","咸阳"],
"河北":["石家庄","邯郸"]
},
"美国":{
"纽约":["a","b"],
"迈阿密":["c","d"],
"休斯顿":["e","f"]
}
}
exit_flag = True
while exit_flag:
for i in address_info:
print (i)
choice = input ("选择进入1>>:")
if choice in address_info:
while exit_flag:
for i2 in address_info[choice]:
print ("\t",i2)
choice2 = input("选择进入2>>:")
if choice2 in address_info[choice]:
while exit_flag:
for i2 in address_info[choice][choice2]:
print ("\t",i2)
choice3 = input("选择进入3>>:")
if choice3 in address_info[choice][choice2]:
while exit_flag:
for i3 in address_info[choice][choice2][choice3]:
print("\t", i3)
choice4 = input ("按b返回:")
if choice4 == "b":
break
elif choice4 == "q":
exit_flag = False
if choice3 == "b":
break
elif choice3 == "q":
exit_flag = False
if choice2 == "b":
break
elif choice2 == "q":
exit_flag = False
if choice == "b":
pass
elif choice == "q":
exit_flag = False