Skip to main content

中国行政区域数据

Project description

中国行政区域数据

根据中国政府网站中的数据处理而成。

install

pip3 install china-region-data

example

from china_region_data import 省级行政区域, 市级行政区域, 县级行政区域, Region


for 省级行政地区 in 省级行政区域:
    print(省级行政地区)
    for 市级行政地区 in 省级行政地区.下级行政区域:
        print("  ", 市级行政地区)
        for 县级行政地区 in 市级行政地区.下级行政区域:
            print("    ", 县级行政地区)

广东 = Region("广东省")
深圳 = Region("深圳市")
南山 = Region("南山区")

assert 广东.name == "广东省"

assert 广东.行政级别 == 1

for 广东城市 in 广东.下级行政区域:
    assert 广东城市.行政级别 == 2

assert 深圳.上级行政地区 == 广东

assert 南山.上级行政地区.上级行政地区 == 广东

assert 南山 in 南山.上级行政地区

assert 南山 in 南山.上级行政地区.上级行政地区

assert not Region("合肥市") in 广东

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

china-region-data-0.1.3.tar.gz (30.9 kB view hashes)

Uploaded Source

Built Distribution

china_region_data-0.1.3-py3-none-any.whl (32.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page