#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Auther:tangnanbing
dict1 = {
"河北省":{
"保定市":["蠡县","易县","安国县"],
"石家庄市":["涿州县1","涿州县2","涿州县3"],
"廊坊市":["大厂县","香河县","燕郊县"]
},
"山东省":{
"德州市": ["平原县","吴桥县","东光县"],
"青岛市": ["崂山区","李沧区","市北区"],
"潍坊市": ["潍城区","寒亭区","安丘县"]
},
"山西省":{
"太原市":["晋中县","交城县","阳曲县"],
"忻州市":["原平县","定襄县","静乐县"],
"朔州市":["山阴县","神池县","右玉县"]
}
}
while True:
print ("系统中存储的省份信息如下:")
for provice_name in(dict1.keys()):
print(provice_name)
input_privice_name = input("请输入您说要查看的省:")
if input_privice_name in (dict1.keys()):
print("您所输入的省份下面有如下市:")
for city_name in (dict1[input_privice_name]):
print (city_name) ###### 打印市
input_city_name = input("请输入您所要查看的市:")
if input_city_name in (dict1[input_privice_name]):
for country_name in (dict1[input_privice_name][input_city_name]):
print(country_name)
print("##############信息查看完毕,回到顶层##########")
elif input_city_name == 'Q':
continue
else:
print("您所输入的市不在所选省份下面,请正确输入")
elif input_privice_name == "Q":
exit()
else:
print("您所输入的省份在系统里不存在,请重新输入:")