擅长:python、mysql、java
<p>不要在<code>(i%2 == 0)</code>时打印<code>name</code>,只需将其保存在变量中,并在下一次迭代中与百分比一起打印:</p>
<pre><code> print("{0}\t{1}".format(name, round(waste)))
</code></pre>
<blockquote>
<p>This method of string formatting (<a href="https://docs.python.org/2/library/stdtypes.html#str.format" rel="nofollow">new in version 2.6</a>) is the new standard in Python 3, and should be preferred to the % formatting described in <a href="https://docs.python.org/2/library/stdtypes.html#string-formatting" rel="nofollow">String Formatting Operations</a> in new code.</p>
</blockquote>