RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
创新互联Python教程:python判断list中某一元素是否存在

在python中判断 list 中是否包含某个元素:可以通过in和not in关键字来判断

例如:

abcList=['a','b','c',1,2,3]
    if 'a' in abcList:
        print('a is in abcList')
    if 'd' not in abcList:
        print('d is not in abcList')
    if 1 in abcList:
        print('1 is in abcList')

结果为:


文章标题:创新互联Python教程:python判断list中某一元素是否存在
网站地址:http://www.jxjierui.cn/article/dhehdeg.html