A currency formatter for many currencies
Project description
Currencies Formatter
The Currencies Formatter Library (or currencies lib) is a Python library designed to simplify the formatting of monetary values for various currencies. It supports a wide range of currencies and provides options for custom formatting. Whether you need to display values with currency symbols or abbreviate large numbers, this library offers a straightforward solution.
Features
- Format monetary values for multiple currencies.
- Custom decimal and symbol options.
- Allows conversion of values to percentage format.
- Utility functions for abbreviating units.
Installing
You can install this library with:
$ pip install currencies-lib
Supports Python 3.10+
Example of use
from currencies_lib import BRL
value = 1250.50
result = BRL(value)
print(result)
# >> "R$1.250,50"
or
from currencies_lib import *
value = 1250.50
result = format_currency(value, "EUR", spaced=True) # Specify currency code
print(result)
# >> "€ 1.250,50"
Additional Examples
# Percentages
print(as_percentage(1000, 25))
# >> 250
print(as_percentage(1000, "25%", subtraction=True))
# >> 750
# Abbreviations
print(unit_abbreviator(1200000))
# >> "1.2M"
Contributing
I welcome contributions to improve this library! If you have suggestions, bug reports, or new feature requests, please open an issue or submit a pull request on my GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for details.
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 currencies_lib-2.0.0.tar.gz.
File metadata
- Download URL: currencies_lib-2.0.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a440e3c22561d5f3ff8df1e8ad9c627aa1fe5d6b61b581626b87676a6eb7ac3c
|
|
| MD5 |
85f40585bf0d2b8038acc96b0324e7d1
|
|
| BLAKE2b-256 |
42853e49d54c257cb93177e68d3560ed289d33eaa0e25e819d95ffc67f9f5780
|
File details
Details for the file currencies_lib-2.0.0-py3-none-any.whl.
File metadata
- Download URL: currencies_lib-2.0.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ce5ee3b9383a9585f53c1f50e696bba63e5e9d7ba8da0f5d40416678c480a9f
|
|
| MD5 |
eb93507e2c2895145450bff23182269e
|
|
| BLAKE2b-256 |
d41abf4b683710274c781ee3f5f1838e022d9449775c0735dd7df7a0bf785237
|