Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40718

Re: Insert comma in number?

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!zen.net.uk!dedekind.zen.co.uk!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <renjoki@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.069
X-Spam-Evidence '*H*': 0.87; '*S*': 0.01; 'locale': 0.07; 'subject:number': 0.09; '","': 0.16; '"."': 0.16; 'sender:addr:gmail.com': 0.18; 'import': 0.21; 'example': 0.23; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'message- id:@mail.gmail.com': 0.27; '>>>>': 0.29; "skip:' 10": 0.30; 'german': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'skip:l 30': 0.35; 'subject:?': 0.35; 'does': 0.37; 'option': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'otten': 0.84; 'from:addr:yandex.ru': 0.91; 'employ': 0.95
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=BLyFp75Ljpk7hcBu0lkKClS//ze9RE0QngV/QTt9YnA=; b=TO7jhoKBZfGQdrg1hwE1lk5Rm7QTWHueFEKitkNUFttzTZg0FY3/zky4qnc8ypW3me 1ORSdzX7WVptCrCHeFSPnKBn+Ha0HrD+/lcEPxgTokTZdlC0o4tpuwDVpvTGF+/3hrAc YNkgu3wpkFuiJalBcacxuOg3FaPoAgNDsXvpzl/6PAFw4ZQSlOCuLSMuYloyLcn8n4/I xlSAS8QP7NwsLn+Npa3mpEt/zbcpT1aIb4/NONu3v4X3VzTJA3GZ8uq2kDFRSyVWzMSy sz6hLziL3LQ2TLhjHHfSN42JXciuyMVlAedsb4TEiELXEor+5gjwiMWillYJs7PJeakr QSig==
MIME-Version 1.0
X-Received by 10.152.134.164 with SMTP id pl4mr27858994lab.54.1362645035998; Thu, 07 Mar 2013 00:30:35 -0800 (PST)
Sender renjoki@gmail.com
In-Reply-To <kh9h53$r38$1@ger.gmane.org>
References <9c8df3b5-510a-4d00-a3ff-0c59799dcded@googlegroups.com> <kh9h53$r38$1@ger.gmane.org>
Date Thu, 7 Mar 2013 12:30:35 +0400
X-Google-Sender-Auth CP1LsPxfPdWFex_aKw34UmsYhbU
Subject Re: Insert comma in number?
From Paul Volkov <capt-obvious@yandex.ru>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2987.1362645043.2939.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362645043 news.xs4all.nl 6974 [2001:888:2000:d::a6]:54925
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40718

Show key headers only | View raw


2013/3/7 Peter Otten <__peter__@web.de>:
> Last not least there's the option to employ locale-aware formatting:
>
>>>> import locale
>>>> locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
> 'en_US.UTF-8'
>>>> locale.format("%d", 12345, grouping=True)
> '12,345'
>
> In German usage of "." and "," is reversed, so:
>
>>>> locale.setlocale(locale.LC_ALL, "de_DE.UTF-8")
> 'de_DE.UTF-8'
>>>> locale.format("%d", 12345, grouping=True)
> '12.345'

Does this locale-aware example only work on UNIX?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Insert comma in number? eli m <techgeek201@gmail.com> - 2013-03-06 15:39 -0800
  Re: Insert comma in number? ian douglas <iandouglas736@gmail.com> - 2013-03-06 15:51 -0800
  Re: Insert comma in number? Chris Rebert <clp2@rebertia.com> - 2013-03-06 16:07 -0800
  Re: Insert comma in number? Terry Reedy <tjreedy@udel.edu> - 2013-03-06 20:28 -0500
  Re: Insert comma in number? Peter Otten <__peter__@web.de> - 2013-03-07 08:55 +0100
  Re: Insert comma in number? Paul Volkov <capt-obvious@yandex.ru> - 2013-03-07 12:30 +0400
  Re: Insert comma in number? Peter Otten <__peter__@web.de> - 2013-03-07 09:58 +0100

csiph-web