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


Groups > comp.lang.python > #45858

Re: PEP 378: Format Specifier for Thousands Separator

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <malaclypse2@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'win32': 0.03; 'parameters': 0.04; 'subject:PEP': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; '23,': 0.16; 'str.format()': 0.16; 'tuple': 0.16; '{}"': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'thu,': 0.19; '>>>': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; '&gt;&gt;&gt;': 0.24; 'cc:2**0': 0.24; 'header:In- Reply-To:1': 0.27; 'returned': 0.30; 'message-id:@mail.gmail.com': 0.30; 'sep': 0.31; 'received:209.85': 0.35; 'received:209.85.220': 0.35; 'received:google.com': 0.35; 'received:209': 0.37; 'skip:& 10': 0.38; 'pm,': 0.38; 'skip:p 20': 0.39; 'carlos': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=vZF8rbi01wDZ3rKWB17ylZl3T7o5iT2wc0ROD12X2qE=; b=e6NKLrJ7PwTf+3j5SvRzjVsbOl4mx4f+6rAfqxZmt5eGWxmurpIXr3c8Z3aJ4bFK0Y iqudUAb9Hd5LptBd/Tw+R8gJeYDev6V0kbD+Aav6A5bggl+0mnr0MgHQ+/erSGc9lUX5 +w8W2AES3wuABRr77MBJEz0qZ7IPdAW9ofyZ9sH3y6URbBhjqkBTMdHan0PXlmR2mQUC QzPTNepMHqIO1yKgMRDniShJpUnriH5MNMXUzP7SQiaZscbgEPFWIa8VwBcv/ZSp7ipJ 32xVAT8RpXHv2kjYzpkktZyj0cpLfZ0HVzhrZZyU5TlXvuuFfrY1S9KGwLWmyW6fxpwL 0pZw==
MIME-Version 1.0
X-Received by 10.68.222.233 with SMTP id qp9mr15346192pbc.63.1369358274509; Thu, 23 May 2013 18:17:54 -0700 (PDT)
In-Reply-To <BLU176-W36CA0353E5678F8D03AC6AD7AA0@phx.gbl>
References <BLU176-W10190CB892A0414C988A05D7A80@phx.gbl> <nad-F52CE7.22440720052013@news.gmane.org> <CADUW+M=Y7b=4ZEENVzx4p6YpVD8T0eG=qz7sz8+iEow-5-o+jQ@mail.gmail.com> <BLU176-W9FF52BDCE42DAF40E6AC7D7A80@phx.gbl> <CANc-5UyWuCd+roRt5V5aocx0vEc1TXfDnG2-phy_gAKSRaqOBA@mail.gmail.com> <knghok$3bd$1@ger.gmane.org> <mailman.1936.1369166040.3114.python-list@python.org> <519c348a$0$6599$c3e8da3$5496439d@news.astraweb.com> <519C3D99.5040107@gmail.com> <mailman.1958.1369219519.3114.python-list@python.org> <519cdcff$0$6599$c3e8da3$5496439d@news.astraweb.com> <mailman.1972.1369249307.3114.python-list@python.org> <87eaaf24-df6a-4f6b-b873-16ca96c12e24@b2g2000yqe.googlegroups.com> <mailman.1977.1369261949.3114.python-list@python.org> <b8623121-631a-4464-bd23-0e210018de78@e13g2000yqp.googlegroups.com> <BLU176-W35FCA0F6068A230026ED88D7AA0@phx.gbl> <519E6327.8070204@davea.name> <knltkb$6b1$1@ger.gmane.org> <BLU176-W36CA0353E5678F8D03AC6AD7AA0@phx.gbl>
Date Thu, 23 May 2013 21:17:54 -0400
Subject Re: PEP 378: Format Specifier for Thousands Separator
From Jerry Hill <malaclypse2@gmail.com>
To Carlos Nepomuceno <carlosnepomuceno@outlook.com>
Content-Type multipart/alternative; boundary=047d7b10d07985c03c04dd6c9103
Cc "python-list@python.org" <python-list@python.org>
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.2046.1369358277.3114.python-list@python.org> (permalink)
Lines 62
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369358277 news.xs4all.nl 15921 [2001:888:2000:d::a6]:56327
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45858

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, May 23, 2013 at 6:20 PM, Carlos Nepomuceno <
carlosnepomuceno@outlook.com> wrote:

> Can str.format() do the following?
>
> f = '%d %d %d'
> v = '1,2,3'
> print f % eval(v)
>

​Sure:

Python 3.2.2 (default, Sep  4 2011, 09:51:08) [MSC v.1500 32 bit (Intel)]
on win32
>>> f = "{} {} {}"
>>> v = "1,2,3"
>>> print(f.format(*eval(v)))
1 2 3
>>>

The * unpacks the tuple returned from eval(), so that you get 3 separate
parameters passed to format(), instead of the single tuple.​

--
​
Jerry​

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


Thread

Re: PEP 378: Format Specifier for Thousands Separator Andrew Berg <bahamutzero8825@gmail.com> - 2013-05-21 14:53 -0500
  Re: PEP 378: Format Specifier for Thousands Separator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-22 02:59 +0000
    Re: PEP 378: Format Specifier for Thousands Separator Andrew Berg <bahamutzero8825@gmail.com> - 2013-05-21 22:38 -0500
    Re: PEP 378: Format Specifier for Thousands Separator Skip Montanaro <skip@pobox.com> - 2013-05-22 05:45 -0500
      Re: PEP 378: Format Specifier for Thousands Separator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-22 14:58 +0000
        Re: PEP 378: Format Specifier for Thousands Separator Ned Batchelder <ned@nedbatchelder.com> - 2013-05-22 14:30 -0400
          Re: PEP 378: Format Specifier for Thousands Separator nn <pruebauno@latinmail.com> - 2013-05-22 13:26 -0700
            RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-23 01:31 +0300
              Re: PEP 378: Format Specifier for Thousands Separator nn <pruebauno@latinmail.com> - 2013-05-23 06:44 -0700
                RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-23 18:26 +0300
                Re: PEP 378: Format Specifier for Thousands Separator Dave Angel <davea@davea.name> - 2013-05-23 14:42 -0400
                Re: PEP 378: Format Specifier for Thousands Separator nn <pruebauno@latinmail.com> - 2013-05-24 06:50 -0700
                Re: PEP 378: Format Specifier for Thousands Separator Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-23 16:19 -0400
                RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-24 01:20 +0300
                Re: PEP 378: Format Specifier for Thousands Separator Jerry Hill <malaclypse2@gmail.com> - 2013-05-23 21:17 -0400
                RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-24 04:41 +0300
            Re: PEP 378: Format Specifier for Thousands Separator Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-05-23 01:30 +0100
            RE: PEP 378: Format Specifier for Thousands Separator Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-23 03:44 +0300

csiph-web