china_cities
is a python package to list Chinese cities and provinces. The cities
can be retrieved in English or Chinese language.
The data is based on wikipedia
as a source
Run pip install china-cities
git clone https://github.com/boeboe/china-cities.git
Run python setup.py install
Run make tests
Run make generate
Some examples on how to use this package.
from china_cities import *
for city in cities.get_cities():
print("english name:", city.name_en)
print("chinese name:", city.name_cn)
print("province: ", city.province)
for city_en in cities.get_cities_en():
print(city_en)
for city_cn in cities.get_cities_cn():
print(city_cn)
for province in cities.get_provinces():
print(province)
for province_city in cities.get_cities_by_province("Anhui"):
print(province_city.name_en)