Skip to main content

PyCNNUM

Convert numbers in Chinese string to/from int/float/str for Python3.8+.

API document



1. Install from PyPI

pip install pycnnum

2. Install from Source

# git is required
git clone https://github.com/zcold/pycnnum.git
cd pycnnum
python -m pip install .

3. Examples

>>> from pycnnum import cn2num, num2cn
>>> cn2num("一百二十三")
123
>>> num2cn(123)
'一百二十三'
>>> cn2num("一兆零四十五", numbering_type="mid")
1000000000045
>>> num2cn(2400, alt_2=True)
'两千四'
>>> num2cn(3.4)
'三点四'

4. Install Development Packages

# example for working under Ubuntu 22.4
# git and python3.8-venv are required
git clone https://github.com/zcold/pycnnum.git pycnnum_dev
cd pycnnum_dev
python3.8 -m venv .venv
source .venv/bin/activate
python -m pip install .[dev] -U

Release files for pycnnum 2.1.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 pycnnum 2.1.1
File Size Uploaded
pycnnum-2.1.1.tar.gz 160.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycnnum 2.1.1
File Interpreter ABI Platform
pycnnum-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 171.4 kB

Release files / pycnnum-2.1.1.tar.gz

Download URL pycnnum-2.1.1.tar.gz
Size 160.2 kB
Tags Source
SHA-256 checksum
How to use checksums
472edd86e2c886ae9be0ae0052ddd125094aca6b9200e21e5d15ba1974698edf
BLAKE2b-256 checksum
How to use checksums
6de92366b7a393ef2c8c662e9fdf4f8af9ca3cd6fdafbe199f077b4fc2e19063
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / pycnnum-2.1.1-py3-none-any.whl

Download URL pycnnum-2.1.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a1d3f2da75293e11c50cb1dedeb582aaf478f864a602ef29313ff31c8992034
BLAKE2b-256 checksum
How to use checksums
9ab45c8fdc83523de02e10610a265a01d51b9aead6da75ef122e1c68772c1845
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.1

2 release files

1.0.0

1 release file

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