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


Groups > comp.lang.python > #41690

how does the % work?

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <l.selmi@icloud.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'error:': 0.05; 'operand': 0.07; 'typeerror:': 0.09; 'sfxlen:2': 0.10; '%s,': 0.16; '(name,': 0.16; 'quest': 0.16; 'unsupported': 0.16; 'to:name:python- list@python.org': 0.20; 'cc:2**0': 0.23; 'example': 0.23; 'cc:addr:python.org': 0.25; 'wrote': 0.26; 'skip:" 20': 0.26; 'thanks!': 0.26; '(most': 0.27; 'file': 0.32; 'print': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'guys': 0.33; 'received:17': 0.35; 'subject:?': 0.35; 'but': 0.36; 'charset:us- ascii': 0.36; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'solve': 0.62; 'color': 0.69; 'type(s)': 0.84
X-Proofpoint-Virus-Version vendor=fsecure engine=2.50.10432:5.10.8626,1.0.431,0.0.0000 definitions=2013-03-22_04:2013-03-22, 2013-03-22, 1970-01-01 signatures=0
X-Proofpoint-Spam-Details rule=notspam policy=default score=0 spamscore=0 ipscore=0 suspectscore=4 phishscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=6.0.2-1302030000 definitions=main-1303220122
From leonardo selmi <l.selmi@icloud.com>
Content-type text/plain; charset=us-ascii
Content-transfer-encoding 7bit
Subject how does the % work?
Date Fri, 22 Mar 2013 18:06:18 +0100
To "python-list@python.org" <python-list@python.org>
MIME-version 1.0 (Mac OS X Mail 6.2 \(1499\))
X-Mailer Apple Mail (2.1499)
Cc "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.3612.1363971987.2939.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363971987 news.xs4all.nl 6923 [2001:888:2000:d::a6]:46933
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41690

Show key headers only | View raw


hi guys

i wrote this example :

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)

but i get this error:  Traceback (most recent call last):
  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'

how can i solve it?

thanks!

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


Thread

how does the % work? leonardo selmi <l.selmi@icloud.com> - 2013-03-22 18:06 +0100
  Re: how does the % work? John Gordon <gordon@panix.com> - 2013-03-22 17:14 +0000
  Re: how does the % work? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-22 11:06 -0700
  Re: how does the % work? Tim Roberts <timr@probo.com> - 2013-03-22 21:29 -0700
    Re: how does the % work? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-23 00:04 -0700
    Re: how does the % work? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-23 07:38 +0000
      Re: how does the % work? Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-23 00:57 -0700
      Re: how does the % work? Michael Torrie <torriem@gmail.com> - 2013-03-23 09:57 -0600
        Re: how does the % work? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-23 23:53 +0000
      Re: how does the % work? leonardo <tampucciolina@libero.it> - 2013-03-23 18:05 +0100
        Re: how does the % work? Tim Roberts <timr@probo.com> - 2013-03-24 16:35 -0700

csiph-web