Marc 'BlackJack' Rintsch wrote:

In <[EMAIL PROTECTED]>, Timothy Smith
wrote:



hi there i need to set my locale so that when i output a number it's formatted with thousands grouped. the problem i've found is there doesn't seem to be very good cross platform support for locales, even between unix's it's horrid.



Have you tried this::

 import locale
 locale
 locale.setlocale(LC_ALL, '')
 locale.format('%.2f', 1000000, True)

The `True` turns on grouping.  Should work cross platform.

Ciao,
Marc 'BlackJack' Rintsch


thats ok, but how do i get it to group thousands with a , ?
and thats would mean i'd have to run everything through a formatter before i displayed it :/ it'd be nicer if i could just select a proper locale
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to