📘 number_to_words
Convert integers into readable English words – simple, fast, and dependency-free.
Overview
number_to_words is a lightweight Python package that converts numbers into English words. It supports values from 0 up to billions, formatted just like humans speak.
✔ No dependencies ✔ Fast and accurate ✔ Easy to import and use ✔ Clean modular implementation
Installation
Install using pip:
pip install number_to_words
Usage
Basic example
import number_to_words as nw
print(nw.num(45)) # forty five
print(nw.num(2024)) # two thousand twenty four
print(nw.num(987654321)) # nine hundred eighty seven million six hundred fifty four thousand three hundred twenty one
Importing the function directly
from number_to_words import num
print(num(123)) # one hundred twenty three
Supported Ranges
| Range | Example Output |
|---|---|
| 0–13 | zero → thirteen |
| 14–19 | fourteen → nineteen |
| 20–99 | twenty one, ninety nine |
| 100–999 | one hundred fifty two |
| 1,000–999,999 | twelve thousand three hundred ten |
| 1,000,000–999,999,999 | ninety eight million ... |
| 1,000,000,000+ | up to billions |
Project Structure
number_to_words/
__init__.py
main.py
ds.py
tens.py
hundreds.py
thousands.py
millions.py
billions.py
Each module handles one specific number range, making the code easy to maintain and extend.
API Reference
num(x: int) -> str
Convert any integer to its English representation.
Example:
from number_to_words import num
num(1200305)
Output:
one million two hundred thousand three hundred five
Contributing
Contributions, issues, and pull requests are welcome.
If you find this package useful, please consider giving the repository a ⭐ on GitHub!
Contact
Author: Saumya Kanti Sarma Email: work.saumyasarma@gmail.com Instagram: saumya__sarma
Feel free to reach out for collaboration, questions, or feedback.
Metadata
Release files for toword 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| toword-0.0.1.tar.gz | 2.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| toword-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.5 kB
Release files / toword-0.0.1.tar.gz
| Download URL | toword-0.0.1.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acdd303e4b9efb86e8be34fab0dee4297f98e26be38c9144fadce491ddb89dfa
|
|
BLAKE2b-256 checksum How to use checksums |
139fd0a2721a00f8b00214229be86f85cbb4b2dd0eed19418b781383fb198a5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / toword-0.0.1-py3-none-any.whl
| Download URL | toword-0.0.1-py3-none-any.whl |
|---|---|
| Size | 2.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d838e65e02dbb2d8c247b4f1c71a279d3cf26d9e8e27464276a0c7831a228c70
|
|
BLAKE2b-256 checksum How to use checksums |
6d89f5722b91af02bc886d47657171e370d5e058ea55ebf38409cc70008ce83a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|