Skip to main content

A Python package for converting numbers to text

Project description

# NumberToWords Library Example

This example demonstrates how to use the `numtowords` library to convert numbers to words in both Persian and English languages.
---
## Installation

First, you need to install the `numtowords` library:

```bash
pip install numtowords

Usage

Here is an example of using the library to convert numbers to words in both Persian and English.

from numtowords import NumberToWords

try:
    # Convert number to words in Persian
    converter_fa = NumberToWords(language='fa')
    print(converter_fa.number_to_words(123456789123456789123456789))  # Sample number in Persian
    
    # Convert number to words in English
    converter_en = NumberToWords(language='en')
    print(converter_en.number_to_words(123456789123456789123456789))  # Sample number in English
except ValueError as e:
    print(f"Error: {e}")

Explanation:

  • This code converts a very large number to words in both Persian and English.
  • If the input number is too large or invalid, a ValueError occurs, and an error message is displayed.

Output:

صد و بیست و سه کوادریلیون چهارصد و پنجاه و شش تریلیون هفتصد و هشتاد و نه بیلیون یکصد و بیست و سه میلیون چهارصد و پنجاه و شش هزار هفتصد و هشتاد و نه one hundred twenty-three quadrillion four hundred fifty-six trillion seven hundred eighty-nine billion one hundred twenty-three million four hundred fifty-six thousand seven hundred eighty-nine


## Notes:

- This code allows you to convert numbers into a readable format in different languages.
- You can change the language of conversion as needed.

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

aaqnumtowords-0.0.2.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aaqnumtowords-0.0.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file aaqnumtowords-0.0.2.tar.gz.

File metadata

  • Download URL: aaqnumtowords-0.0.2.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for aaqnumtowords-0.0.2.tar.gz
Algorithm Hash digest
SHA256 952d023d6a0376e03fad86a9d9c176f210349c1b0f77fed3168f869d88bd428a
MD5 1ece33f5583b75172e8bfafb0987b3f4
BLAKE2b-256 d0107d9edec522d5ec0df416a57bd2bee0b0b03fc0cd2a5c3a94a6c5c5837467

See more details on using hashes here.

File details

Details for the file aaqnumtowords-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: aaqnumtowords-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for aaqnumtowords-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c12202504f15ea391328709d0c957263d481c38120e74d5533fc300cfc8ba271
MD5 c6a8e82b9843110794a5c5692df334e6
BLAKE2b-256 7443666e44854637787e4ea2f19e329bcd48bbc8ad09bef3c1825638acc20466

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page