[Baypiggies] Currency to Words or how to print checks...

Eric Walstad eric at ericwalstad.com
Wed Jan 5 06:56:52 CET 2011


Hi All,

I'm blowing the dust off this ancient New Years resolution of mine:

  * Add the ability to print checks to my accounting software

I'm using ReportLab to generate a pdf file and I have everything
working except the 'word form' of the check amount.  I found some
examples on SO[0] but it's clear I'd need to tweak that to work.  I
found pynum2word on SF[1] which looks promising with nice looking code
except that it seems to have an issue with floating point:

In [11]: n2w.to_cardinal(1234.56)
Out[11]: 'one thousand, two hundred and thirty-four point five five'

For my app, I want the output to be:
'one thousand, two hundred thirty-four and 56/100'

I can edit pynum2word to make it do what I want but I figured I'd ask
if any of you know of other/better approaches.

Thanks in advance,

Eric.
[0] http://stackoverflow.com/questions/309884/code-golf-number-to-words
[1] http://sf.net/projects/pynum2word/


More information about the Baypiggies mailing list