Untitled

 avatar
user_1004214
python
6 days ago
460 B
0
Indexable
Never
pip install num2words

from num2words import num2words

print(num2words(10001))  # cardinal is default

# Output ou saida ===> ten thousand and one

print(num2words(20.22, to='currency'))
# Output===> twenty euro, twenty cents

print(num2words(2022, to='year'))

# output ===> twenty twenty-two

print(num2words(3, to='ordinal'))

# output===> third (terceiro)

print(num2words(3, to='ordinal_num'))

# output===> 3rd == terceiro abreviado
Leave a Comment