region_list={"河北省":{"石家庄":["新乐","新集","赵县"],"保定":["唐县","满城","涞源"]}, "山西":{"太原":["小店区","杏花岭区"],"大同":["大同县","西花园"]}} def the_menu(): print("*" * 10 + "欢迎来到地区查询系统" + "*" * 10) for i in region_list: print(i) print("-"*40) while True: the_input=input("输入q:=返回上级,输入a:=退出,输入地区:=查看下级信息:") if the_input=="a": break elif the_input=="河北省": for k in region_list["河北省"]: print(k) while True: the__input = input("返回上级输入:q请输入地区名称:") if the__input=="保定": for i in region_list["河北省"]["保定"]: print(i) elif the__input=="石家庄": for i in region_list["河北省"]["石家庄"]: print(i) elif the__input=="q": break elif the_input=="山西": for i in region_list["山西"]: print(i) while True: the__input = input("请输入地区名称:") if the__input == "太原": for i in region_list["山西"]["太原"]: print(i) elif the__input == "大同": for i in region_list["山西"]["大同"]: print(i) elif the__input == "q": break else: break the_menu()