1 data = { 2 '北京':{ 3 "昌平":{ 4 "沙河":["oldboy","test"], 5 "天通苑":["链家地产","我爱我家"] 6 }, 7 "朝阳":{ 8 "望京":["奔驰","陌陌"], 9 "国贸":{ "CICC","HP"},10 "东直门":{ "Advent","飞信"},11 },12 "海淀":{},13 },14 '山东':{15 "德州":{},16 "青岛":{},17 "济南":{}18 },19 '广东':{20 "东莞":{},21 "常熟":{},22 "佛山":{},23 "深圳":{24 "福田":{},25 "南山":{},26 "罗湖":{},27 "宝安":{},28 "龙华":{},29 }30 },31 '广西':{32 '南宁':{},33 '柳州':{},34 '桂林':{35 "灵川":{},36 "兴安":{},37 "全州":{},38 "灌阳":{},39 "恭城":{},40 "阳朔":{},41 "荔浦":{},42 "临桂":{},43 "龙胜":{},44 "永福":{},45 },46 '梧州':{},47 '玉林':{},48 '贺州':{},49 '河池':{},50 }51 }52 exit_flag = False53 54 while not exit_flag:55 for i in data:56 print (i)57 choice = input("选择进入1>>:")58 if choice in data:59 while not exit_flag:60 for i2 in data[choice]:61 print("\t",i2)62 choice2 = input("选择进入2>>:")63 if choice2 in data[choice]:64 while not exit_flag:65 for i3 in data[choice][choice2]:66 print("\t\t",i3)67 choice3 = input("选择进入3>>:")68 if choice3 in data[choice][choice2]:69 for i4 in data[choice][choice2][choice3]:70 print("\t\t",i4)71 choice4 = input("最后一层,按b返回>>:")72 if choice4 == "b":73 pass74 elif choice4 == "q":75 exit_flag = True76 if choice3 == "b":77 break78 elif choice3 == "q":79 exit_flag = True80 if choice2 == "b":81 break82 elif choice2 == "q":83 exit_flag = True