Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24669
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <Joshua.R.English@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'mrab': 0.05; 'function,': 0.07; 'accepts': 0.09; 'arguments,': 0.09; 'braces': 0.09; 'friday,': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'subject:not': 0.11; '(the': 0.15; 'attributes.': 0.16; 'braces,': 0.16; 'subscripting': 0.16; 'string': 0.17; 'wrote:': 0.17; 'specify': 0.17; '>>>': 0.18; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'format,': 0.27; "doesn't": 0.28; 'josh': 0.29; 'sense': 0.31; 'print': 0.32; 'right?': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'method': 0.36; 'thank': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:" 10': 0.40; 'you.': 0.61; 'between': 0.63; 'therefore': 0.65; "'foo'": 0.84; 'hand,': 0.97 |
| Newsgroups | comp.lang.python |
| Date | Fri, 29 Jun 2012 10:19:30 -0700 (PDT) |
| In-Reply-To | <mailman.1636.1340989364.4697.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=76.115.184.65; posting-account=yMP7kQoAAAAXsyJyvL-3qYVslbdYOSQP |
| References | <7d1714cb-7aea-4048-bdc5-1b65d0f6c109@googlegroups.com> <mailman.1636.1340989364.4697.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 76.115.184.65 |
| MIME-Version | 1.0 |
| Subject | Re: format() not behaving as expected |
| From | Josh English <Joshua.R.English@gmail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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> |
| Message-ID | <mailman.1637.1340990373.4697.python-list@python.org> (permalink) |
| Lines | 19 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1340990373 news.xs4all.nl 6853 [2001:888:2000:d::a6]:57878 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:24669 |
Show key headers only | View raw
On Friday, June 29, 2012 10:02:45 AM UTC-7, MRAB wrote:
>
> The ".format" method accepts multiple arguments, so the placeholders in
> the format string need to specify which argument to format as well as
> how to format it (the format specification after the ":").
>
> The "format" function, on the other hand, accepts only a single
> argument to format, so it needs only the format specification, and
> therefore can't accept subscripting or attributes.
>
> >>> c = "foo"
> >>> print "{0:s}".format(c)
> foo
> >>> format(c, "s")
> 'foo'
Thank you. That's beginning to make sense to me. If I understand this, everything between the braces is the format specification, and the format specification doesn't include the braces, right?
Josh
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
format() not behaving as expected Josh English <Joshua.R.English@gmail.com> - 2012-06-29 09:31 -0700
Re: format() not behaving as expected MRAB <python@mrabarnett.plus.com> - 2012-06-29 18:02 +0100
Re: format() not behaving as expected Josh English <Joshua.R.English@gmail.com> - 2012-06-29 10:19 -0700
Re: format() not behaving as expected MRAB <python@mrabarnett.plus.com> - 2012-06-29 18:41 +0100
Re: format() not behaving as expected Josh English <Joshua.R.English@gmail.com> - 2012-06-29 10:19 -0700
Re: format() not behaving as expected Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-06-29 17:08 +0000
Re: format() not behaving as expected Josh English <Joshua.R.English@gmail.com> - 2012-06-29 10:24 -0700
csiph-web