1、身份运算符:判断内存地址是否相同
is
is not
li = [11, 22, 33, 1, 2, 3] li2 = [11, 22, 33, 1, 2, 3] li3 = li print(li is li2) print(li is li3)
结果:
False
True
2、成员运算符: in not in
li = [11, 22, 33, 1, 2, 3] a = 11 print(a in li)
结果:True
1、身份运算符:判断内存地址是否相同
is
is not
li = [11, 22, 33, 1, 2, 3] li2 = [11, 22, 33, 1, 2, 3] li3 = li print(li is li2) print(li is li3)
结果:
False
True
2、成员运算符: in not in
li = [11, 22, 33, 1, 2, 3] a = 11 print(a in li)
结果:True