Skip to main content

A Python package for converting numbers to text

Project description

NumberToWords Library Example

This example demonstrates how to use the aaqnumtowords library to convert numbers to words in both Persian and English languages.

Installation

First, you need to install the aaqnumtowords library:

pip install aaqnumtowords

Usage

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

from aaqnumtowords 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.4.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.4-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aaqnumtowords-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 44512e06dab9cb24a3adf0679622ec638dde7720aea8b9006be9463b2caaffc6
MD5 c1d3ecdaca2fd0b4f856d3db264e2ad5
BLAKE2b-256 ba78c761a0927fcfb66a8fd89c10d9eb89a961d09113d88f4a1bf5aaef0df51b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aaqnumtowords-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3988a6d0d51afa259b50fccfc773773c1220cfc012fa641b9088a3ff97855535
MD5 baeed5b424b1bd1abf67b4331b0c617f
BLAKE2b-256 f3f40a307df273af2609bea4f68fc08437390e32ba0ea03963446854f314d8df

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