The Python implementation for looking up the Chinese administrative divisions.
Project description
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:
.. code-block:: python
>>> 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:
.. code-block:: python
>>> 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 <https://github.com/cn/GB2260/blob/develop/spec.md>`_ for details.
Issues
------
If you want to report bugs or request features, please create issues on
`GitHub Issues <https://github.com/cn/GB2260/issues>`_.
External Links
--------------
- `GB/T 2260-2002 in Wikipedia <https://zh.wikipedia.org/zh-cn/GB/T_2260-2002>`_
- `Codes for administrative divisions of PRC <http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201401/t20140116_501070.html>`_
.. |GB/T 2260| image:: http://img.shields.io/badge/GB%2FT-2260-blue.svg?style=flat
:target: https://github.com/cn/GB2260
:alt: GB/T 2260
.. |Build Status| image:: https://img.shields.io/travis/cn/GB2260.py.svg?style=flat
:target: https://travis-ci.org/cn/GB2260.py
:alt: Build Status
.. |Coverage Status| image:: https://img.shields.io/coveralls/cn/GB2260.py.svg?style=flat
:target: https://coveralls.io/r/cn/GB2260.py
:alt: Coverage Status
.. |Wheel Status| image:: https://img.shields.io/pypi/wheel/GB2260.svg?style=flat
:target: https://warehouse.python.org/project/GB2260
:alt: Wheel Status
.. |PyPI Version| image:: https://img.shields.io/pypi/v/GB2260.svg?style=flat
:target: https://pypi.python.org/pypi/GB2260
:alt: PyPI Version
======
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:
.. code-block:: python
>>> 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:
.. code-block:: python
>>> 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 <https://github.com/cn/GB2260/blob/develop/spec.md>`_ for details.
Issues
------
If you want to report bugs or request features, please create issues on
`GitHub Issues <https://github.com/cn/GB2260/issues>`_.
External Links
--------------
- `GB/T 2260-2002 in Wikipedia <https://zh.wikipedia.org/zh-cn/GB/T_2260-2002>`_
- `Codes for administrative divisions of PRC <http://www.stats.gov.cn/tjsj/tjbz/xzqhdm/201401/t20140116_501070.html>`_
.. |GB/T 2260| image:: http://img.shields.io/badge/GB%2FT-2260-blue.svg?style=flat
:target: https://github.com/cn/GB2260
:alt: GB/T 2260
.. |Build Status| image:: https://img.shields.io/travis/cn/GB2260.py.svg?style=flat
:target: https://travis-ci.org/cn/GB2260.py
:alt: Build Status
.. |Coverage Status| image:: https://img.shields.io/coveralls/cn/GB2260.py.svg?style=flat
:target: https://coveralls.io/r/cn/GB2260.py
:alt: Coverage Status
.. |Wheel Status| image:: https://img.shields.io/pypi/wheel/GB2260.svg?style=flat
:target: https://warehouse.python.org/project/GB2260
:alt: Wheel Status
.. |PyPI Version| image:: https://img.shields.io/pypi/v/GB2260.svg?style=flat
:target: https://pypi.python.org/pypi/GB2260
:alt: PyPI Version
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
GB2260-v2-0.2.0.tar.gz
(2.0 MB
view hashes)
Built Distribution
Close
Hashes for GB2260_v2-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 684cf7a12002d5bde45bf51b687238d48bcdecc7db14a58334254db1e75a9ce5 |
|
MD5 | d091814a2c743b454ea3ed305a1c7d98 |
|
BLAKE2b-256 | 3ad28ad3e4502305ee5f4948eb6b862cce321275155d8d87f32d4450042d9c6e |