擅长:python、mysql、java
<p>你在这里做的是:</p>
<pre><code>if (not uname) and passwd:
</code></pre>
<p>如果要检查它们是否都为假,则需要执行以下操作:</p>
^{pr2}$
<p>请注意:</p>
<pre><code>if not (uname and passwd):
</code></pre>
<p>不是同一件事,好像一件事是真的,整个事情都会判假。如果您想用一个<code>not</code>来完成,正确的逻辑是:</p>
<pre><code>if not (uname or passwd):
</code></pre>