Skip to main content

Utilities for parsing strings into numbers, and printing numbers as pretty strings

Project description

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.

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

numutil-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

File details

Details for the file numutil-0.1.0.tar.gz.

File metadata

  • Download URL: numutil-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for numutil-0.1.0.tar.gz
Algorithm Hash digest
SHA256 14664171809c3b00bb4d6349d6bc3b7b0a42100d28d265a1f24e303554c31f57
MD5 a3a775931edb013d8bc03bd9ffe1f876
BLAKE2b-256 5864bb59c911eea1caac4b6828f3eda2545bb88a86c20260acfa5f1f78382a7b

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