#Author:Kevin_hou data ={ "中国":{ "上海": { "浦东": { "曹路":{}, "川沙":{}, "唐镇":{}, "张江":{}, "金桥":{}, "北蔡":{} }, "黄埔":{}, "徐汇":{}, "静安":{} }, "苏州":{ "吴江":{ "松陵":{}, "盛泽":{}, "同里":{}, }, "姑苏":{}, "吴中":{}, "工业园":{} }, "宿州":{ "砀山":{ "西南门":{}, "梁梨":{}, "园艺场":{} } } }, "日本":{}, "韩国":{}, "泰国":{} } exit_flag =False while not exit_flag: for i in data: print(i) choice1 = input("进入第一级菜单>>>:") if choice1 in data: while not exit_flag: for i1 in data[choice1]: print(" ",i1) choice2 = input("进入第二级菜单>>>:") if choice2 in data[choice1]: while not exit_flag: for i2 in data[choice1][choice2]: print(" ",i2) choice3 = input("进入第三级菜单>>>:") if choice3 in data[choice1][choice2]: while not exit_flag: for i3 in data[choice1][choice2][choice3]: print(" ",i3) choice4 = input("进入最后一层,输入b返回上一层>>>:") # while not exit_flag: # print(" ",i4) if choice4 =="b": break # pass 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