Skip to main content

liuxiaojing

English | 中文

中文数字与整数互转。

安装

pip install liuxiaojing

用法

from liuxiaojing import to_chinese, to_int

to_int("三千零五")      # 3005
to_int("一百零二")      # 102
to_int("两万")          # 20000

to_chinese(3005)       # '三千零五'
to_chinese(0)          # '零'

说明

支持 0 到 99999999 的整数。解析容忍「〇」「两」「廿」等常见写法;超出范围、出现无法识别的字符、或「零」位置非法时抛 ValueError。输出统一用简化字,不加「壹贰」等大写形式。

许可证

MIT


English

Convert between Chinese numerals and integers.

Install

pip install liuxiaojing

Usage

from liuxiaojing import to_chinese, to_int

to_int("三千零五")      # 3005
to_int("一百零二")      # 102
to_int("两万")          # 20000

to_chinese(3005)       # '三千零五'
to_chinese(0)          # '零'

Notes

Handles integers from 0 to 99,999,999. Parsing accepts common variants such as 〇, 两 and 廿; out-of-range values, unknown characters or misplaced 零 raise ValueError. Output always uses the plain simplified forms.

License

MIT

Metadata

Release files for liuxiaojing 0.0.2

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

Source distribution (sdist)

Source distribution for liuxiaojing 0.0.2
File Size Uploaded Provenance Actions
liuxiaojing-0.0.2.tar.gz 3.7 kB Without provenance Details for liuxiaojing-0.0.2.tar.gz

Built distribution (wheel)

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

Total release size: 7.8 kB

Release files / liuxiaojing-0.0.2.tar.gz

Download URL liuxiaojing-0.0.2.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0478e6794676d84859fecc5416173535d520b088ddce417584815d8ae4da4b83
BLAKE2b-256 checksum
How to use checksums
6810b5a0049c171dffeda42d101584f036779d520726fb5d757082f95afb3060
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / liuxiaojing-0.0.2-py3-none-any.whl

Download URL liuxiaojing-0.0.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8797620d2068081dcb3f17e410722424fddb7f6988cd458177b7e129039b52be
BLAKE2b-256 checksum
How to use checksums
a1ffd011f05c85c309d6c425131d44ce3a01be07331ec5661f0c8787294aefc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for liuxiaojing 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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