擅长:python、mysql、java
<h2>好办法是:</h2>
<p>最好的方法是使用<a href="https://docs.python.org/3/library/stdtypes.html#str.format" rel="nofollow">^{<cd1>}</a></p>
<pre><code>print("The length of '{}' is {}".format(word, word_length))
</code></pre>
<h2>坏方法:</h2>
<p>使用C-like语句时,请注意这一点没有被强调(但还没有正式地<em>弃用</em>)</p>
<pre><code>print("The length of '%s' is %s" % (word, word_length))
</code></pre>
<h2>丑陋的方式:</h2>
<p>一种方法是使用<code>'</code>和<a href="https://docs.python.org/3.4/library/functions.html#print" rel="nofollow">^{<cd3>} attribute</a>将字符串相加</p>
<pre><code>print("The length of '", word,"' is ", word_length, sep = '')
</code></pre>