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
ValueErroroccurs, 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aaqnumtowords-0.0.1.tar.gz.
File metadata
- Download URL: aaqnumtowords-0.0.1.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9da581741691403b021b2f03e231bf3a7440acc374f19a3275b6c62bd1844d15
|
|
| MD5 |
6910001d3cfb9555ec1c836ce35172f3
|
|
| BLAKE2b-256 |
9b9076fe7602727ea0119071d70f61dc1d49c6dc899e420ac5bd0a4081736b71
|
File details
Details for the file aaqnumtowords-0.0.1-py3-none-any.whl.
File metadata
- Download URL: aaqnumtowords-0.0.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0323df9e708f95ef8a97aa0c229c702d99f3be7aee2feae8a25eafd98d19bebc
|
|
| MD5 |
187168b3bff9d87c6d9eff0bc6300235
|
|
| BLAKE2b-256 |
d1752ed11ec9402a6a2e1a1d6ca5b911f2352fbfb1d6e98f7b4e5857ec3e73d5
|