pycnnum API documentation

# pycnnum

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

Example:

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

- `pycnnum.pycnnum.cn2num`
- `pycnnum.pycnnum.num2cn`

View Source

     1"""Chinese number <=> int/float conversion for Python3.8+
     2
     3Example:
     4
     5```python
     6
     7>>> from pycnnum import cn2num, num2cn
     8>>> from pycnnum import cn2num, num2cn
     9>>> cn2num("一百二十三")
    10123
    11>>> num2cn(123)
    12'一百二十三'
    13>>> cn2num("一兆零四十五", numbering_type="mid")
    141000000000045
    15>>> num2cn(2400, alt_2=True)
    16'两千四'
    17>>> num2cn(3.4)
    18'三点四'
    19
    20```
    21
    22- `.pycnnum.cn2num`
    23- `.pycnnum.num2cn`
    24"""
    25
    26from .__version__ import __version__
    27from .pycnnum import cn2num, num2cn