2019-03-26
阅读量:
489
Python中的运算符==
pyhton中的==运算符作用主要是检查两者的值相等的值进行比较。虽然是运营商检查两个操作数是否指向同一对象或没有。
# python3 code to
# illustrate the
# difference between
# == and is operator
# [] is an empty list
list1 = []
list2 = []
list3=list1
if (list1 == list2):
print("True")
else:
print("False")
if (list1 is list2):
print("True")
else:
print("False")
if (list1 is list3):
print("True")
else:
print("False")
输出:
True
False
True






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论