[Tutor] String Formatting

orbitz orbitz at ezabel.com
Fri Sep 10 04:55:22 CEST 2004


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