【发布时间】:2013-03-21 11:27:18
【问题描述】:
我需要检查一个元素是否不在两个列表中。我目前有:
if ele not in lista:
if ele not in listb:
do stuff
使用以下代码不起作用。有没有更有效的方式在 python 中完成上述操作?
if ele not in lista and listb:
do stuff
【问题讨论】:
标签: python list if-statement