Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107764
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Stephen Hansen <me@ixokai.io> |
| Newsgroups | comp.lang.python |
| Subject | Re: Python Madlibs.py code and error message |
| Date | Wed, 27 Apr 2016 23:50:46 -0700 |
| Lines | 28 |
| Message-ID | <mailman.177.1461826249.32212.python-list@python.org> (permalink) |
| References | <3cff626c-28a2-499c-9877-de2df4d459d0@googlegroups.com> <dodj48Fb8o8U1@mid.individual.net> <6c0d96c5-c7f5-4659-a2e9-20f8d202d701@googlegroups.com> <1461820617.3238425.591942249.1484DAC3@webmail.messagingengine.com> <85fuu6jo1o.fsf@benfinney.id.au> <1461826246.3257796.591992793.54C5CC58@webmail.messagingengine.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="utf-8" |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de hZCnAT2jfy+241+sQHX0/gqo+0ohImtjXxevFYQDX7hQ== |
| Return-Path | <me@ixokai.io> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'subject:Python': 0.05; 'formatting': 0.07; 'subject:code': 0.07; '"my': 0.09; 'positional': 0.09; 'received:internal': 0.09; 'python': 0.10; 'subject:error': 0.11; 'wed,': 0.15; 'argument': 0.15; '"bring': 0.16; '"first,': 0.16; '(ie,': 0.16; 'better:': 0.16; 'examples:': 0.16; 'formatting.': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'mismatch': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:io': 0.16; 'received:messagingengine.com': 0.16; 'received:psf.io': 0.16; 'shalt': 0.16; '{0}': 0.16; '{0}"': 0.16; '{name}"': 0.16; '{}"': 0.16; 'wrote:': 0.16; 'string': 0.17; '(not': 0.20; 'arguments': 0.22; 'stephen': 0.22; 'leave': 0.23; 'references': 0.23; 'header:In-Reply-To:1': 0.24; 'error': 0.27; 'parameters': 0.27; 'implicitly': 0.29; "i'm": 0.30; 'url:python': 0.33; 'except': 0.34; 'url:org': 0.36; 'keyword': 0.36; 'url:library': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:10': 0.37; 'missing': 0.37; 'received:66': 0.38; 'means': 0.39; 'format': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'url:3': 0.60; 'header:Message-Id:1': 0.61; 'between': 0.65; '10:32': 0.84; 'url:string': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d=ixokai.io; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=yz7N2s4sFfCH16lWy7V5+cQ4QuM=; b=cP3MG3 YtsOsr7R/HAmHTz9M4J5EelzOj1iU5luhzaK01rIXtPQqUn3sl0no0CIQjKAbnBl 6nS9bvP2ToyYwgmJd8FiD6Esi6G87tjOGH0vRQdMwYLK8QV+RLU8BlpEishdpHip F+hO2OmGvuwAYndXNHs/lnpWadvdoqrkTkgik= |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=yz7N2s4sFfCH16l Wy7V5+cQ4QuM=; b=nWYFIKD6lCV9pvBiGRm4k73IGfFRGXaxOoU+2vpc5anXn17 kHadYqAOehXO6aUwVzGIKLhDCjvKPCx8rMXgROJkQVDy8qt6akpDgIx4X+ad+xPe 9y/sU7Ujtqzt1v2FWV7JUYh0/YoPAe+s1lcslGvaxp2AIRuOW1Db/FoXY+/E= |
| X-Sasl-Enc | 5Kqle0YNAF9quX2oK25ABDZB8NfikhjHE2J6K0gcZCLN 1461826246 |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-f1265324 |
| In-Reply-To | <85fuu6jo1o.fsf@benfinney.id.au> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <1461826246.3257796.591992793.54C5CC58@webmail.messagingengine.com> |
| X-Mailman-Original-References | <3cff626c-28a2-499c-9877-de2df4d459d0@googlegroups.com> <dodj48Fb8o8U1@mid.individual.net> <6c0d96c5-c7f5-4659-a2e9-20f8d202d701@googlegroups.com> <1461820617.3238425.591942249.1484DAC3@webmail.messagingengine.com> <85fuu6jo1o.fsf@benfinney.id.au> |
| Xref | csiph.com comp.lang.python:107764 |
Show key headers only | View raw
On Wed, Apr 27, 2016, at 10:32 PM, Ben Finney wrote:
> Stephen Hansen <me+python@ixokai.io> writes:
>
> > The error message means there's a mismatch between the number of
> > formatting instructions (ie, %s) and arguments passed to formatting. I
> > leave it to you to count and find what's missing or extra, because I'm
> > seriously not going to do that :)
>
> Better: when you have many semantically-different values, use named (not
> positional) parameters in the format string.
>
> Some simple format string examples:
>
> "First, thou shalt count to {0}" # References first positional
> argument
> "Bring me a {}" # Implicitly references the first
> positional argument
> "From {} to {}" # Same as "From {0} to {1}"
> "My quest is {name}" # References keyword argument 'name'
> […]
>
> <URL:https://docs.python.org/3/library/string.html#formatstrings>
Except the poster is not using Python 3, so all of this is for naught.
--
Stephen Hansen
m e @ i x o k a i . i o
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python Madlibs.py code and error message Cai Gengyang <gengyangcai@gmail.com> - 2016-04-27 21:37 -0700
Re: Python Madlibs.py code and error message Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-04-28 16:50 +1200
Re: Python Madlibs.py code and error message Cai Gengyang <gengyangcai@gmail.com> - 2016-04-27 22:01 -0700
Re: Python Madlibs.py code and error message Stephen Hansen <me+python@ixokai.io> - 2016-04-27 22:16 -0700
Re: Python Madlibs.py code and error message Ben Finney <ben+python@benfinney.id.au> - 2016-04-28 15:32 +1000
Re: Python Madlibs.py code and error message Stephen Hansen <me@ixokai.io> - 2016-04-27 23:50 -0700
Re: Python Madlibs.py code and error message Ben Finney <ben+python@benfinney.id.au> - 2016-04-28 16:55 +1000
Re: Python Madlibs.py code and error message Stephen Hansen <me@ixokai.io> - 2016-04-28 00:08 -0700
Re: Python Madlibs.py code and error message Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-04-28 17:25 +1000
Re: Python Madlibs.py code and error message Cai Gengyang <gengyangcai@gmail.com> - 2016-05-03 04:12 -0700
Re: Python Madlibs.py code and error message Ben Finney <ben+python@benfinney.id.au> - 2016-04-28 17:17 +1000
Re: Python Madlibs.py code and error message Stephen Hansen <me+python@ixokai.io> - 2016-04-27 21:55 -0700
csiph-web