not in
判断某个元素(成员)是否不在此数据结构中
names = ['xiaoming', 'xiaoliang', 'xiaozhang']
print(bool('xiaoming' not in names))
print(bool('xiaoming2' not in names))
结果
False
True
判断某个元素(成员)是否不在此数据结构中
names = ['xiaoming', 'xiaoliang', 'xiaozhang']
print(bool('xiaoming' not in names))
print(bool('xiaoming2' not in names))
结果
False
True