擅长:python、mysql、java
<p><code>pass</code>什么也不做,它只是使Python缩进正确。你知道吗</p>
<hr/>
<p>假设你想创建一个空函数,比如:</p>
<pre class="lang-py prettyprint-override"><code>def empty_func():
empty_func() # throws IndentationError
</code></pre>
<p>让我们试着在里面放一条评论:</p>
<pre><code>def empty_func_with_comment():
# empty
empty_func_with_comment() # throws IndentationError
</code></pre>
<p>要使其工作,我们需要使用pass来修复压痕:</p>
<pre><code>def empty_func_with_pass():
pass
empty_func_with_pass() # it works
</code></pre>