Skip to content Skip to sidebar Skip to footer

Django Template How To Convert Numbers To Words

I am searching for a template tag to convert a value like 522 to five hundred twenty two only. Looking in docs i came across django.contrib.humanize which has a build in tag int

Solution 1:

Check out this library: num2words

Straight from the docs:

>>>from num2words import num2words>>>num2words(42)
forty-two
>>>num2words(42, ordinal=True)
forty-second
>>>num2words(42, lang='fr')
quarante-deux

Post a Comment for "Django Template How To Convert Numbers To Words"