python 中如何判斷list中是否包含某個元素

在python中能夠經過in和not in關鍵字來判讀一個list中是否包含一個元素python theList = [‘a’,’b’,’c’]  if ‘a’ in theList:  print ‘a in the list’app if ‘d’ not in theList:  print ‘d is not in the list’spa
相關文章
相關標籤/搜索