擅长:python、mysql、java
<p>因为有两个打印语句。一是内部功能,二是外部功能。当函数不返回任何东西时,它不返回任何值。</p>
<p>在函数末尾使用<code>return</code>语句返回值。</p>
<p>例如:</p>
<p>不返回值。</p>
<pre><code>>>> def test1():
... print "In function."
...
>>> a = test1()
In function.
>>> print a
None
>>>
>>> print test1()
In function.
None
>>>
>>> test1()
In function.
>>>
</code></pre>
<p>使用返回语句</p>
<pre><code>>>> def test():
... return "ACV"
...
>>> print test()
ACV
>>>
>>> a = test()
>>> print a
ACV
>>>
</code></pre>