Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cn/GB2260.py
The Python implementation for looking up Chinese administrative divisions.
https://github.com/cn/GB2260.py
Last synced: 4 months ago
JSON representation
The Python implementation for looking up Chinese administrative divisions.
- Host: GitHub
- URL: https://github.com/cn/GB2260.py
- Owner: cn
- License: bsd-2-clause
- Created: 2014-12-15T15:37:36.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-05-19T19:21:49.000Z (about 4 years ago)
- Last Synced: 2024-03-06T14:44:56.879Z (4 months ago)
- Language: Python
- Size: 29.3 KB
- Stars: 123
- Watchers: 14
- Forks: 32
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Lists
- awesome-python-decorator - GB2260.py
README
|GB/T 2260| |Build Status| |Coverage Status| |PyPI Version| |Wheel Status|
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)``:.. code-block:: python
>>> import gb2260
>>>
>>> division = gb2260.get(360426)
>>> print(division)
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)
>>> print(division.prefecture)
>>> print(division.county)
The hierarchic divisions could be generated with a iterator method:
.. code-block:: python
>>> division.stack()
>>> for current in division.stack():
... print(u'{0} {1}'.format(current.name, current.code))
江西省 360000
九江市 360400
德安县 360426Issues
------If you want to report bugs or request features, please create issues on
`GitHub Issues `_.External Links
--------------- `GB/T 2260-2002 in Wikipedia `_
- `Codes for administrative divisions of PRC `_.. |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