numerals -> words
Raja S.
raja at cs.indiana.edu
Mon Oct 9 13:26:38 EDT 2000
Common Lisp's format statement has a "~r" directive which can be used to
convert a numeral into it's English description:
* (format t "~r" 1992)
one thousand nine hundred ninety-two
* (format t "~R" 1992)
one thousand nine hundred ninety-two
* (format t "~R" 47)
forty-seven
* (format t "~R" 2000)
two thousand
* (format t "~R" 2001)
two thousand one
Is there a pre-existing way of doing the equivalent in Python?
Thanks in advance.
Raja
Thought I'd ask first before building something custom.
Should be straight forward to do for a limited range though the CL folks have
pretty much gone all the way !!
* (format t "~R" 1234567890123456789012345678901234567890)
one duodecillion two hundred thirty-four undecillion five hundred
sixty-seven decillion eight hundred ninety nonillion one hundred
twenty-three octillion four hundred fifty-six septillion seven hundred
eighty-nine sextillion twelve quintillion three hundred forty-five
quadrillion six hundred seventy-eight trillion nine hundred one billion two
hundred thirty-four million five hundred sixty-seven thousand eight hundred
ninety
*
More information about the Python-list
mailing list