Skip to main content

GB2260

The Python implementation for looking up the Chinese administrative divisions.

Installation

$ pip install GB2260

Basic Usage

The way to look up a administrative division by its GB2260 code is the basic interface gb2260.get(code):

>>> import gb2260
>>>
>>> division = gb2260.get(360426)
>>> print(division)
<gb2260.Division 360426 江西省/九江市/德安县>

The data of a division is accessible to interfaces as following:

>>> division.code
u'360426'
>>> division.name
u'德安县'
>>> division.is_county
True
>>> division.is_province
False
>>> division.is_prefecture
False
>>> print(division.province)
<gb2260.Division 360000 江西省>
>>> print(division.prefecture)
<gb2260.Division 360400 江西省/九江市>
>>> print(division.county)
<gb2260.Division 360426 江西省/九江市/德安县>

The hierarchic divisions could be generated with a iterator method:

>>> division.stack()
<generator object stack at 0x103e26a50>
>>> for current in division.stack():
...     print(u'{0} {1}'.format(current.name, current.code))
江西省 360000
九江市 360400
德安县 360426

Issues

If you want to report bugs or request features, please create issues on GitHub Issues.

Metadata

Release files for GB2260 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for GB2260 0.4.1
File Size Uploaded Provenance
GB2260-0.4.1.tar.gz 464.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for GB2260 0.4.1
File Interpreter ABI Platform
GB2260-0.4.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 945.7 kB

Release files / GB2260-0.4.1.tar.gz

Download URL GB2260-0.4.1.tar.gz
Size 464.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b7b31c1549e53b7b8c517ca793c1395fae9c0c81cb2158b7ff4b61bee7d42546
BLAKE2b-256 checksum
How to use checksums
ca014b1a1a593fbe8dcc016f3eddab7978801b7c4bd328077200c4cd430072b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / GB2260-0.4.1-py2.py3-none-any.whl

Download URL GB2260-0.4.1-py2.py3-none-any.whl
Size 481.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7708e26955a09b647d4f2d263961df763e97d6f98790921defbb190745342f10
BLAKE2b-256 checksum
How to use checksums
136669a0545ed97d3689ff422a2504ff51a298a78b4795fe05228ef944bc22f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for GB2260 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page