day3-三级目录

date = {"guangdong":{"guangzhou":{"tianhe":["tyx","zjxc"],
"panyu":["a","b"]},
"maoming":{},
"zhongshan":{}},
"henan":{"jiaozuo":{"boai":["nan","bei"],
"wen":["c","d"]},
"zhengzhou":{},
"luoyang":{}},
"shandong":{"jinan":{},
"qingdao":{}}}
exit_flag = True
while exit_flag:
for i in date:
print(i)
choice = input("please choose")
if choice in date:
while exit_flag:
for i2 in date[choice]:
print(i2)
choice2 = input("please choose2")
if choice2 in date[choice]:
while exit_flag:
for i3 in date[choice][choice2]:
print(i3)
choice3 = input("please choose3")
if choice3 in date[choice][choice2]:
for i4 in date[choice][choice2][choice3]:
print(i4)
choice4 = input("Ending!Return please press 'b'.")
if choice4 == "b":
pass
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

猜你喜欢

转载自www.cnblogs.com/yvanquan/p/10660557.html