🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

pycnnum

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pycnnum

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

2.1.1
Source
PyPI
Maintainers
1

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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts