#定义一个多级列表,字典
dic={
    'shanxi':{
        'xa':{
            '西安1':["lantian"],
            '西安2':["huxian"],
            '西安3':["changan"]
        },
        'bj':"宝鸡市",
        'hz':"汉中市"
    },
    'ningxia':{
        'yc':"银川市",
        'szs':"石嘴山市",
        'zw':"中卫市"
    },
    'shandong':{
        'jn':"济南市",
        'qd':"青岛市",
        'yt':"烟台市"
    }
}


while True:
    one=input("        ***   您要查看列表吗?   ***\n"
              "***  输入a查看,输入b返回,输入c退出  *** \n\n"
                "请输入: ")
    if one=="a":
        while True:
            print(dic.keys())
            two = input("输入名称进入二级列表:")
            if two=="b":
                break
            elif two=="c":
                exit()
            else:
                while True:
                    print(dic[two].keys())
                    three = input("输入名称进入三级列表:")
                    if three=="b":
                        break
                    elif three=="c":
                        exit()
                    else:
                        while True:
                            print(dic[two][three])
                            val = input("b返回上级,c退出程序:")
                            if val == 'b':
                                break
                            elif val == 'c':
                                exit()

    elif one=="b":
        break
    elif one=="c":
        exit()
    else:
        print("您输入有误")