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.

Files for china-region-data, version 0.1.5
Filename, size File type Python version Upload date Hashes
Filename, size china_region_data-0.1.5-py3-none-any.whl (32.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size china-region-data-0.1.5.tar.gz (31.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page