Money formatting

T

Tonguc Yumruk

I'm trying to format an integer as money. As far as i can see there is
no strfmon() in python. I also tried the
locale.format("%.2f",100000000,True) way but it does not even made the
grouping work. I tried to hack some locale-related files (especially
/usr/share/i18n/locales/tr_TR), but it dosn't worked either. Of course I
can use brute force and make grouping and money formatting to work by
hand but I think it's not a very pythonic way. Are there any library
functions which I'm missing? Or will I have to use brute force?

My system is:
Debian GNU/Linux: Sarge
Python Version: Python 2.3.4
Locale: tr_TR.ISO8859-9

--
Love Respect GNU/Linux
########################################################################
<MrCurious> by the power of greyskull
<MrCurious> someone tell me the ban to place
<Sopwith> mrcurious: *.debian.org, *.novare.net
<philX> *.debian.org. that's awesome.
-- Seen on LinuxNet #linux
########################################################################
Tonguç Yumruk

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA58wh1xWu4MLSyoYRAqQcAJ4zHRG469c4EBUEj158NFDohvfGfgCfZ0+R
AfWmugq0+SZAN+CGrT9iCd0=
=qN2O
-----END PGP SIGNATURE-----
 
D

Dan Bishop

Tonguc Yumruk said:
I'm trying to format an integer as money. As far as i can see there is
no strfmon() in python. I also tried the
locale.format("%.2f",100000000,True) way but it does not even made the
grouping work. I tried to hack some locale-related files (especially
/usr/share/i18n/locales/tr TR), but it dosn't worked either. Of course I
can use brute force and make grouping and money formatting to work by
hand but I think it's not a very pythonic way. Are there any library
functions which I'm missing? Or will I have to use brute force?

I get the same problem:
'1234.56'

But this seems to fix it:
'1,234.56'
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top