Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40813
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jjposner@optimum.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.125 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.78; '*S*': 0.03; 'subject:number': 0.09; '-john': 0.16; 'to:addr:web.de': 0.16; 'wrote:': 0.17; 'import': 0.21; 'to:2**1': 0.23; 'least': 0.25; 'header:User-Agent:1': 0.26; 'regular': 0.27; 'to:addr:python-list': 0.33; 'subject:?': 0.35; 'option': 0.37; 'quite': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'otten': 0.84; 'received:167': 0.84; 'employ': 0.95 |
| Date | Thu, 07 Mar 2013 14:06:03 -0500 |
| From | John Posner <jjposner@optimum.net> |
| Subject | Re: Insert comma in number? |
| In-reply-to | <mailman.15214.1362647403.2938.python-list@python.org> |
| To | python-list@python.org, Peter Otten <__peter__@web.de> |
| MIME-version | 1.0 |
| Content-type | text/plain; charset=ISO-8859-1 |
| Content-transfer-encoding | 7BIT |
| X-Enigmail-Version | 1.5.1 |
| References | <mailman.15214.1362647403.2938.python-list@python.org> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 |
| 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.3047.1362684983.2939.python-list@python.org> (permalink) |
| Lines | 15 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1362684983 news.xs4all.nl 6867 [2001:888:2000:d::a6]:51075 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:40813 |
Show key headers only | View raw
Peter Otten wrote: > Last not least there's the option to employ locale-aware formatting: Not quite last ... there's the mind-bending regular expression route: import re re.sub(r"(?<=\d)(?=(\d\d\d)+$)", ",", "12345678") # 12,345,678 re.sub(r"(?<=\d)(?=(\d\d\d)+$)", ",", "-54321") # -54,321 -John
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Insert comma in number? John Posner <jjposner@optimum.net> - 2013-03-07 14:06 -0500
csiph-web