Money formatting
Dan Bishop
danb_83 at yahoo.com
Mon Jul 5 15:34:56 EDT 2004
More information about the Python-list mailing list
Mon Jul 5 15:34:56 EDT 2004
- Previous message (by thread): conversion between (OS native) paths and urls
- Next message (by thread): Money formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tonguc Yumruk <tongucyumruk at member.fsf.org> wrote in message news:<mailman.396.1088932913.27577.python-list at python.org>... > 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: >>> import locale >>> locale.format('%.2f', 1234.56, True) '1234.56' But this seems to fix it: >>> locale.setlocale(locale.LC_NUMERIC, 'en_US.ISO8859-1') 'en_US.ISO8859-1' >>> locale.format('%.2f', 1234.56, True) '1,234.56'
- Previous message (by thread): conversion between (OS native) paths and urls
- Next message (by thread): Money formatting
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list