擅长:python、mysql、java
<p>来自<a href="https://docs.python.org/3/whatsnew/2.6.html#what-s-new-in-python-2-6" rel="nofollow noreferrer">What’s New in Python 2.6</a>文档中的<a href="http://docs.python.org/whatsnew/2.6.html#pep-3105-print-as-a-function" rel="nofollow noreferrer">PEP 3105: print As a Function</a>:</p>
<pre><code>>>> from __future__ import print_function
>>> print('a', end='')
</code></pre>
<p>显然,这只适用于python 3.0或更高版本(或者2.6+在开头使用<code>from __future__ import print_function</code>)。在Python 3.0中,<code>print</code>语句被删除,并默认成为<code>print()</code>函数。</p>