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