擅长:python、mysql、java
<p>马克·西德的回答是对的——你需要提供一个元组。</p>
<p>但是,从Python 2.6开始,您可以使用<a href="http://docs.python.org/library/stdtypes.html#str.format" rel="noreferrer">^{<cd1>}</a>而不是<code>%</code>:</p>
<pre><code>'{0} in {1}'.format(unicode(self.author,'utf-8'), unicode(self.publication,'utf-8'))
</code></pre>
<p>不再鼓励使用<code>%</code>格式化字符串。</p>
<blockquote>
<p>This method of string formatting is the new standard in Python 3.0, and should be preferred to the % formatting described in String Formatting Operations in new code.</p>
</blockquote>