10 lines
298 B
Python
10 lines
298 B
Python
from __future__ import annotations
|
|
|
|
from decimal import Decimal
|
|
|
|
|
|
def currency(value: Decimal | float | int) -> str:
|
|
amount = Decimal(str(value or 0)).quantize(Decimal("0.01"))
|
|
formatted = f"{amount:,.2f}".replace(",", "_").replace(".", ",").replace("_", ".")
|
|
return f"{formatted} €"
|