标签:over ret hang false ipa input lis pad sha
三级菜单:
data={
‘Beijing‘:{
‘Changping‘:{
‘shahe1‘:[‘cook1‘,‘book1‘],
‘tiantongyuan1‘:[‘TV1‘,‘IPAD1‘]
},
‘Chaoyang‘:{
‘shahe2‘: [‘cook2‘, ‘book2‘],
‘tiantongyuan1‘:[‘TV1‘,‘IPAD1‘]
},
},
‘Jiangsu‘:{
‘Xuzhou‘:{
‘Suining‘:[‘goverment1‘,‘department1‘],
‘Tongshan‘:[‘goverment2‘,‘department2‘]
},
‘Nanjing‘: {
‘Liuhe‘: [‘goverment1‘, ‘department1‘],
‘Lishui‘: [‘goverment2‘, ‘department2‘]
},
},
}
exit_flag=False
while not exit_flag:
for i1 in data:
print(i1)
choice=input("choose1>>:")
if choice in data:
while not exit_flag:
for i2 in data[choice]:
print("\t",i2)
choice2=input("choose2>>:")
if choice2 in data[choice]:
while not exit_flag:
for i3 in data[choice][choice2]:
print("\t\t",i3)
choice3=input("choose3>>:")
if choice3 in data[choice][choice2]:
while not exit_flag:
for i4 in data[choice][choice2][choice3]:
print("\t\t\t",i4)
choice4=input("Press b to return the last level>>:")
if choice4 == "b":
break
elif choice4=="q":
exit_flag = True
if choice3 == "b":
break
elif choice3 == "q":
exit_flag = True
if choice2 == "b":
break
elif choice2 == "q":
exit_flag = True
elif choice == "q":
exit_flag = True
标签:over ret hang false ipa input lis pad sha
原文地址:https://www.cnblogs.com/taosun/p/11746134.html