Skip to main content

Chinese number <=> int/float conversion for Python3.8+

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycnnum-2.1.1.tar.gz (160.2 kB view details)

Uploaded Source

Built Distribution

pycnnum-2.1.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file pycnnum-2.1.1.tar.gz.

File metadata

  • Download URL: pycnnum-2.1.1.tar.gz
  • Upload date:
  • Size: 160.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for pycnnum-2.1.1.tar.gz
Algorithm Hash digest
SHA256 472edd86e2c886ae9be0ae0052ddd125094aca6b9200e21e5d15ba1974698edf
MD5 90f8b912750a279cf4ded32370a36fdb
BLAKE2b-256 6de92366b7a393ef2c8c662e9fdf4f8af9ca3cd6fdafbe199f077b4fc2e19063

See more details on using hashes here.

File details

Details for the file pycnnum-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: pycnnum-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for pycnnum-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a1d3f2da75293e11c50cb1dedeb582aaf478f864a602ef29313ff31c8992034
MD5 3e8c3dc231cca1b3b56f27b00f5d9d62
BLAKE2b-256 9ab45c8fdc83523de02e10610a265a01d51b9aead6da75ef122e1c68772c1845

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page