Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #40813 > unrolled thread
| Started by | John Posner <jjposner@optimum.net> |
|---|---|
| First post | 2013-03-07 14:06 -0500 |
| Last post | 2013-03-07 14:06 -0500 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Insert comma in number? John Posner <jjposner@optimum.net> - 2013-03-07 14:06 -0500
| From | John Posner <jjposner@optimum.net> |
|---|---|
| Date | 2013-03-07 14:06 -0500 |
| Subject | Re: Insert comma in number? |
| Message-ID | <mailman.3047.1362684983.2939.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web