新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python判斷l(xiāng)ist中某一元素是否存在
在python中判斷 list 中是否包含某個元素:可以通過in和not in關(guān)鍵字來判斷

例如:
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')
結(jié)果為:
分享文章:創(chuàng)新互聯(lián)Python教程:python判斷l(xiāng)ist中某一元素是否存在
URL地址:http://fisionsoft.com.cn/article/dhehdeg.html


咨詢
建站咨詢
