zl程序教程

您现在的位置是:首页 >  后端

当前栏目

python序列中是否包含某个元素

Python序列 是否 元素 包含 某个
2023-09-11 14:14:34 时间

http://outofmemory.cn/code-snippet/9098/python-list-contains-with-in-not-in

 

theList = ['a','b','c']
if 'a' in theList:
    print 'a in the list'

if 'd' not in theList:
    print 'd is not in the list'