[Python-checkins] r64952 - peps/trunk/pep-3101.txt
Eric Smith
eric at trueblade.com
Mon Jul 14 19:02:06 CEST 2008
Raymond Hettinger wrote:
>> Author: eric.smith
>> Added '#' alternate formatting for integers. See issue 3138.
>
> I would *really* like to see some way to specify a thousands separator.
> Going through the locale module is a pita for this common need.
Use the 'n' formatter. Admittedly, you have to have already set the
correct locale.
$ ./python.exe
Python 2.6b1+ (trunk:64757M, Jul 8 2008, 14:09:11)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'en_US')
'en_US'
>>> format(1000, 'n')
'1,000'
>>>
More information about the Python-checkins
mailing list