擅长:python、mysql、java
<p>你可以试试<code>if all((a,b is not None)): pass</code></p>
<pre><code>In [31]: a = 1
In [32]: b = 1
In [33]: all((a,b is not None))
Out[33]: True
In [34]: b = None
In [35]: all((a,b is not None))
Out[35]: False
</code></pre>
<p><strong>注意:</strong>
将<code>a</code>或<code>b</code>的值设置为<code>0</code>将产生<code>True</code></p>
<p><strong>Python?</strong></p>
<pre><code>In [36]: len('if a is not None and b is not None')
Out[36]: 34
In [37]: len('all((a,b is not None))')
Out[37]: 22
</code></pre>