擅长:python、mysql、java
<p>也许这可以帮助你回答问题:</p>
<pre><code>>>> def printy(string):
print string
>>> printy("hello %s" % "world")
hello world
>>> printy("hello %s") % "world"
hello %s
Traceback (most recent call last):
File "<pyshell#278>", line 1, in <module>
printy("hello %s") % "world"
TypeError: unsupported operand type(s) for %: 'NoneType' and 'str'
>>>
</code></pre>
<p>如您所见,您没有在正确的位置包含%运算符或其补充。在</p>
<p>你甚至可以参考这些文档:<a href="http://docs.python.org/release/2.4.4/lib/typesseq-strings.html" rel="nofollow">http://docs.python.org/release/2.4.4/lib/typesseq-strings.html</a></p>
<p>还包括在python附带的python帮助文档中。在</p>