11 用户交互,显示省市县三级联动的选择
dict = {
"河北": {
"石家庄":{"晋州市","平山县","元氏"},
"邯郸": {"永年","涉县","磁县"},
},
"河南": {
"郑州": {"新郑","荥阳","新密"},
"周口": {"项城","淮阳","太康"},
}
}
inp1 = input("用户输入省份:")
for i in dict[inp1]:
print(i)
inp2 = input("用户输入城市:")
for j in dict[inp1][inp2]:
print(j)
for j in dict[inp1][inp2]:
print(j)