ctnx.number module¶
- ctnx.number.num_to_words(n: int | float | AnyStr | Decimal) str[source]¶
Convert a number to Vietnamese words.
Convert a number to its Vietnamese formal spoken form. It supports long numbers (both integers and decimals).
- Parameters:
n (int, float, Decimal or str) – The number to be converted. If n is a str, it will be converted to a Decimal object.
- Returns:
The spoken form of the number
- Return type:
- Raises:
TypeError – If the input’s type is neither int, float, str nor Decimal
ValueError – If the input string does not represent a valid number