Skip to main content

cid

https://img.shields.io/pypi/v/cid.svg https://img.shields.io/pypi/dm/cid.svg

Chinese Identity Parser

提取身份证号码中的生日、性别、办证区域, 校验身份证号码格式是否正确

Install

pip install cid

Usage

In [1]: from cid import IdParser

In [2]: ip = IdParser()

In [3]: ip.parse('360730198601011111')
Out[3]:
{'birthday': '1986-01-01',
 'gender': '男',
 'region': {'city': '赣州市', 'district': '宁都县', 'province': '江西省'}}

# 校验身份证号码格式是否正确

In [4]: ip.is_valid_cid('360730198601011111')
Out[4]: False


In [5]: ip.extract_gender('360730198601011111')
Out[5]: '男'

In [6]: ip.extract_birthday('360730198601011111')
Out[6]: '1986-01-01'

In [7]: ip.extract_region('360730198601011111')
Out[7]: {'city': '赣州市', 'district': '宁都县', 'province': '江西省'}

# 除了提取发证地,需要实例化 IdParser 外, 其他方法可直接使用

In [8]: from cid import (is_valid_cid, extract_gender, extract_birthday)

Changelog

0.1.3 - Dec 19, 2017

  • update data.csv

0.1.2 - Dec 19, 2017

  • update data.csv

0.1.1 - Apr 5, 2016

  • update data.csv

0.1 - Apr 1, 2016

  • first version

Metadata

Release files for cid 0.1.3

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

Source distribution (sdist)

Source distribution for cid 0.1.3
File Size Uploaded Provenance
cid-0.1.3.tar.gz 48.3 kB Without provenance Details

Release files / cid-0.1.3.tar.gz

Download URL cid-0.1.3.tar.gz
Size 48.3 kB
Tags Source
SHA-256 checksum
How to use checksums
284a18b81e0ae80b0e2f4dc50cba1613e9cda57461548a79fc10df24b7c3a2f3
BLAKE2b-256 checksum
How to use checksums
379f6b35865564203bede50edd72a7089c0f0ec0ece4f43dbde87d554d5c9b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for cid 0.1.3

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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