GB2260-v2

The Python implementation for looking up the Chinese administrative divisions.


License
BSD-3-Clause
Install
pip install GB2260-v2==0.2.1

Documentation

GB/T 2260 Build Status Coverage Status PyPI Version Wheel Status

GB2260-v2

The Python implementation for looking up the Chinese administrative divisions.

Installation

$ pip install GB2260-v2

Basic Usage

The way to look up a administrative division by its GB2260 code is the basic interface:

>>> from gb2260_v2 import GB2260
>>> gb2260 = GB2260()
>>>
>>> division = gb2260.get('360426')
>>> print(division)
<Division 360426 德安县 rev=201801>

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)
<Division 360000 江西省 rev=201801>
>>> print(division.prefecture)
<Division 360400 九江市 rev=201801>

See Specification v0.2 for details.

Issues

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

External Links