Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit3.readnews.com!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: how does the % work? Date: Fri, 22 Mar 2013 17:14:42 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 33 Message-ID: References: NNTP-Posting-Host: panix1.panix.com X-Trace: reader2.panix.com 1363972482 14647 166.84.1.1 (22 Mar 2013 17:14:42 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Fri, 22 Mar 2013 17:14:42 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:41692 In leonardo selmi writes: > 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 > favourite color is %s.''') % (name, quest, color) > TypeError: unsupported operand type(s) for %: 'NoneType' and 'tuple' > how can i solve it? Are you sure you've given us the exact code? The printed text doesn't exactly match. ("favorite" vs. "favourite", three double-quotes vs three single-quotes, etc.) The error message also says that the print statement has a close-parenthesis after the string and before the arguments, which may be real problem. -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"