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


Groups > comp.lang.python > #41696

Re: [Python-Help] how does the % work?

Path csiph.com!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bgailer@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:: [': 0.03; 'subject:Python': 0.05; 'operand': 0.07; 'typeerror:': 0.09; 'cc:addr:python-list': 0.10; 'subject:Help': 0.10; '%s,': 0.16; '(name,': 0.16; 'chapel': 0.16; 'quest': 0.16; 'unsupported': 0.16; 'wrote:': 0.17; 'subject:] ': 0.19; 'code.': 0.20; 'runs': 0.22; 'this:': 0.23; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:" 20': 0.26; 'post': 0.28; 'code': 0.31; 'file': 0.32; 'print': 0.32; 'traceback': 0.33; 'received:google.com': 0.34; 'received:192.168.2': 0.34; 'list': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'message- id:@gmail.com': 0.36; 'does': 0.37; 'received:209': 0.37; 'received:192': 0.39; 'received:192.168': 0.40; 'subject:-': 0.40; 'your': 0.60; 'color': 0.69; 'me!': 0.84; 'type(s)': 0.84; 'bob': 0.91; 'hill': 0.96
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=5pnT6L7NfHSzb1I6aS7socafHYNVOloK3wodRYkjiXY=; b=nwmdLUfsCh5vThIiccaxkmS5xanmJCxNKn9DDELXYROlgg2mQNUwjciKCTcPZd/cJz YJIftQuYgPrnN8TFrl4gaNsDMtkBF6qAycKxnfZetjvlwYb74hf3AxCeSBoVwuLZjtCu hjpWCMwuia5NaYIg+hyZnndFX/RQqrDQFAkQMpoHLF3WDcmW/4xRUDVkMN5MLMsjXnl0 PVrriPzDxrGnEIWoFc9rKqu4XvIp0xvgC8dpbxRxRxjRKoWvnuGWmcfuEmRbFG6n7Lmr HU0oQVq6huLbW6e/BwIve0fTbIrHjLxK2SrS9cELUJ8m8r6QDxGitqeb+RvCk6RCOquv PI5g==
X-Received by 10.236.105.130 with SMTP id k2mr1570992yhg.191.1363973504766; Fri, 22 Mar 2013 10:31:44 -0700 (PDT)
Date Fri, 22 Mar 2013 13:31:49 -0400
From bob gailer <bgailer@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 5.2; rv:17.0) Gecko/20130307 Thunderbird/17.0.4
MIME-Version 1.0
To leonardo selmi <l.selmi@icloud.com>
Subject Re: [Python-Help] how does the % work?
References <759DD1C4-83A8-4501-9C32-53A5C89D5D49@icloud.com>
In-Reply-To <759DD1C4-83A8-4501-9C32-53A5C89D5D49@icloud.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Cc "python-list@python.org" <python-list@python.org>, "help@python.org" <help@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.3615.1363973983.2939.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363973983 news.xs4all.nl 6905 [2001:888:2000:d::a6]:38936
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41696

Show key headers only | View raw


It is better to post to just one list at a time.

On 3/22/2013 1:06 PM, leonardo selmi wrote:
> name = raw_input("What is your name?")
> quest = raw_input("What is your quest?")
> color = raw_input("What is your favorite color?")
>
> print """Ah, so your name is %s, your quest is %s,
> and your favorite color is %s."""  % (name, quest, color)
Runs OK for me!

The traceback does not match the code. Please post the code that 
actually generated this:

   File "/Users/leonardo/print.py", line 5, in <module>
     favourite color is %s.''') % (name, quest, color)
TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple'


-- 
Bob Gailer
919-636-4239
Chapel Hill NC

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


Thread

Re: [Python-Help] how does the % work? bob gailer <bgailer@gmail.com> - 2013-03-22 13:31 -0400

csiph-web