Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.015 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:PEP': 0.07; 'integers': 0.09; 'possible?': 0.16; 'received:65.55.116.7': 0.16; 'specifier': 0.16; 'unsigned': 0.16; '>>>': 0.22; 'to:name:python- list@python.org': 0.22; 'integer': 0.24; 'received:65.55.116': 0.24; "i'm": 0.30; "i'd": 0.34; 'something': 0.35; 'there': 0.35; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40 X-TMN: [fWoMJIT1NmZtAWlxvsD5j+DFstanvvcv] X-Originating-Email: [carlosnepomuceno@outlook.com] From: Carlos Nepomuceno To: "python-list@python.org" Subject: PEP 378: Format Specifier for Thousands Separator Date: Tue, 21 May 2013 08:17:36 +0300 Importance: Normal Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 21 May 2013 05:17:36.0824 (UTC) FILETIME=[81C19380:01CE55E2] X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369113524 news.xs4all.nl 15980 [2001:888:2000:d::a6]:60932 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45642 Is there a way to format integers with thousands separator (digit grouping)= like the format specifier of str.format()?=0A= =0A= I'm currently using the following:=0A= =0A= >>> sys.stdout.write('Number =3D %s\n' % '{:=2C.0f}'.format(x))=0A= Number =3D 12=2C345=0A= =0A= 'x' is unsigned integer so it's like using a sledgehammer to crack a nut!= =0A= =0A= I'd like to have something like:=0A= =0A= sys.stdout.write('Number =3D %=2Cu\n' % x)=0A= =0A= =0A= Is that possible? How can I do it if not already available? =