This article is mainly implemented: User interaction, showing the choice of three-level linkage between counties and cities
Code:
#!/usr/bin/env python
#-*-Coding:utf-8-*-
# Author by LH
DIC = {
' Hebei ': {
' Shijiazhuang ': [' Luquan ', ' Gaocheng ', ' Yuanshi '],
' Handan ': [' Yongnian ', ' She county ', ' CI '],
},
' Henan ': {
' Zhengzhou ': [' Zhongyuan ', ' Erqi District ', ' Jinshui '],
' Kaifeng ': [' longting district ', ' Gu Lou ', ' Yu Wang Tai District ']
},
' Shanxi ': {
' Taiyuan ': [' Yinze District ', ' Xinghualing District ', ' Wanbolin District '],
' Datong ': [' Datong County ', ' Tianzhen County ', ' Hunyuan County ']
}
}
For I1 in DIC:
Print I1
Province=raw_input (' Please enter province: ')
A=dic[province]
For I2 in a:
Print I2
City=raw_input (' Please enter City: ')
B=a[city]
For i3 in B:
Print i3
Operation Result:
Show the choice of three-level linkage between province, city and county