Erlo

python_4

2019-10-27 00:00:16 发布   849 浏览  
页面报错/反馈
收藏 点赞

三级菜单:

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("tt",i3)
choice3=input("choose3>>:")
if choice3 in data[choice][choice2]:
while not exit_flag:
for i4 in data[choice][choice2][choice3]:
print("ttt",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
登录查看全部

参与评论

评论留言

还没有评论留言,赶紧来抢楼吧~~

手机查看

返回顶部

给这篇文章打个标签吧~

棒极了 糟糕透顶 好文章 PHP JAVA JS 小程序 Python SEO MySql 确认