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. [â] >> >> import locale >> locale >> locale.setlocale(LC_ALL, '') >> locale.format('%.2f', 1000000, True) >> >>The `True` turns on grouping. Should work cross platform. > > 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
It uses the locale of the system. If *your* systems locale is configured to use ',' as separator for grouping, then it should be used by `locale.format()`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list