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


Groups > comp.lang.python > #41696

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

Date 2013-03-22 13:31 -0400
From bob gailer <bgailer@gmail.com>
Subject Re: [Python-Help] how does the % work?
References <759DD1C4-83A8-4501-9C32-53A5C89D5D49@icloud.com>
Newsgroups comp.lang.python
Message-ID <mailman.3615.1363973983.2939.python-list@python.org> (permalink)

Show all headers | 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