Convert numbers into English words easily
Project description
📘 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.
Project details
Release history Release notifications | RSS feed
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 toword-0.0.1.tar.gz.
File metadata
- Download URL: toword-0.0.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
acdd303e4b9efb86e8be34fab0dee4297f98e26be38c9144fadce491ddb89dfa
|
|
| MD5 |
0d252e39545bf0999f8d8dbe4e08f70e
|
|
| BLAKE2b-256 |
139fd0a2721a00f8b00214229be86f85cbb4b2dd0eed19418b781383fb198a5f
|
File details
Details for the file toword-0.0.1-py3-none-any.whl.
File metadata
- Download URL: toword-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d838e65e02dbb2d8c247b4f1c71a279d3cf26d9e8e27464276a0c7831a228c70
|
|
| MD5 |
577cf8047129d781a10d608c85383d8a
|
|
| BLAKE2b-256 |
6d89f5722b91af02bc886d47657171e370d5e058ea55ebf38409cc70008ce83a
|