当前位置:主页 > 软件编程 > Python代码 >

Python 查看list中是否含有某元素的方法

时间:2021-04-01 08:18:24 | 栏目:Python代码 | 点击:

用关键字 in 和not in 来

如下:

qwe =[1,2,3,4,5] 
if 2 in qwe: 
print ‘good!' 
else: 
print ‘not good'

666

您可能感兴趣的文章:

相关文章