<p>我只是试着调用这个代码</p>
<pre><code>uname=""
passwd="jhj"
if uname =="":print "uname"
if passwd=="":print "passwd"
if not uname and passwd:
print "either"
</code></pre>
<p>输出是:</p>
^{pr2}$
<p>不应该是“uname”吗?我该怎么解决这个问题?在</p>
<p>您需要将<code>if not uname and passwd</code>中的<code>not</code>应用于uname和passwd:</p>
<p><code>if not uname and not passwd</code></p>
<p>或者:</p>
<p><code>if not any((uname, passwd))</code></p>