[Tutor] String Formatting
Isr Gish
isrgish at fastem.com
Fri Sep 10 16:34:24 CEST 2004
Thanks orbitz,
But...
>oldloc = locale.setlocale(locale.LC_ALL)
>locale.setlocale(locale.LC_ALL, 'en_US')
>locale.format('%d', some_num, True)
>locale.setlocale(locale.LC_ALL, oldloc)
>
I would rather not use this way, iit takes about 25 times longer then a regular % format. And I'm using it for about 1,000,000 times.
Isr
-----Original Message-----
>From: "orbitz"<orbitz at ezabel.com>
>Sent: 9/9/04 10:55:22 PM
>To: "Isr Gish"<isrgish at fastem.com>, "tutor at python.org"<tutor at python.org>
>Subject: Re: [Tutor] String Formatting
>
>Easiest way would probably be using locale.format in some code I do:
>
>oldloc = locale.setlocale(locale.LC_ALL)
>locale.setlocale(locale.LC_ALL, 'en_US')
>locale.format('%d', some_num, True)
>locale.setlocale(locale.LC_ALL, oldloc)
>
>
>Isr Gish wrote:
>
>>Hi,
>>
>>How can I format a integer in a format string with a comma for example
>>print 'Your Account has %f' %amount
>>That should print:
>>Your Account has 1,000.00
>>
>>Thanks
>>Isr
>>
>>_______________________________________________
>>Tutor maillist - Tutor at python.org
>>http://mail.python.org/mailman/listinfo/tutor
>>
>>
>>
>
More information about the Tutor
mailing list