python中成员操作符

 

>>> test1
['aaa', 'bbb', 'ccc']
>>> "aaa" in test1
True
>>> "ddd" in test1
False
>>> "ccc" in test1
True
>>> "ddd" not in test1
True
>>> "aaa" not in test1
False

 

>>> test1
['aaa', 'bbb', 'ccc']
>>> test1.insert(1,["fff","ggg"])
>>> test1
['aaa', ['fff', 'ggg'], 'bbb', 'ccc']
>>> "aaa" in test1
True
>>> "fff" in test1
False
>>> "fff" not in test1
True

 

posted @ 2020-12-18 21:27  小鲨鱼2018  阅读(91)  评论(0编辑  收藏  举报