Reprinted: python checks whether a certain element is in the list

Reprinted: Thanks to the blogger for the article portal

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

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_41529093/article/details/112598325