Re: formatting a string with thousands separators

2008-09-07 Thread Fredrik Lundh
James Mills wrote: There is a much easier more consistent way: import locale locale.setlocale(locale.LC_ALL, "en_AU.UTF-8") 'en_AU.UTF-8' doesn't work on all Python platforms, though: >>> locale.setlocale(locale.LC_ALL, "en_AU.UTF-8") Traceback (most recent call last): File "", line 1, i

Re: formatting a string with thousands separators

2008-09-07 Thread James Mills
Hi, There is a much easier more consistent way: >>> import locale >>> locale.setlocale(locale.LC_ALL, "en_AU.UTF-8") 'en_AU.UTF-8' >>> locale.format("%0.2f", 500, True) '5,000,000.00' >>> cheers James On Mon, Sep 8, 2008 at 5:24 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On 9/7/2008 12:2

Re: formatting a string with thousands separators

2008-09-07 Thread Alan G Isaac
On 9/7/2008 12:22 PM SimonPalmer apparently wrote: anyone recommend a way of formatting floats with comma separators? http://code.activestate.com/recipes/498181/ Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

formatting a string with thousands separators

2008-09-07 Thread SimonPalmer
anyone recommend a way of formatting floats with comma separators? e.g. 50.00 -> 500,000.00 -- http://mail.python.org/mailman/listinfo/python-list