Skip to main content

Convert between numbers and strings

Strings to Numbers:

>>> from numutil import str2num, num2str
>>> str2num('1.3 million')
1300000
>>> str2num('three and a half')
Fraction(7, 2)
>>> str2num('123,456.789')
123456.789

Numbers to Strings:

>>> num2str(1234567, style='newspaper')
'1.23 million'
>>> num2str(1234567, style='words')
'one million, two hundred thirty four thousand, five hundred sixty seven'

numutil might be useful for people mining data from text, or for people running web apps that need to parse numbers from user-entered strings, or render numbers in a user-friendly format.

Metadata

Release files for numutil 0.1.0

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

Source distribution (sdist)

Source distribution for numutil 0.1.0
File Size Uploaded Provenance Actions
numutil-0.1.0.tar.gz 8.4 kB Without provenance Details for numutil-0.1.0.tar.gz

Release files / numutil-0.1.0.tar.gz

Download URL numutil-0.1.0.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
14664171809c3b00bb4d6349d6bc3b7b0a42100d28d265a1f24e303554c31f57
BLAKE2b-256 checksum
How to use checksums
5864bb59c911eea1caac4b6828f3eda2545bb88a86c20260acfa5f1f78382a7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for numutil 0.1.0

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.1.0 This release

1 release file 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