热线电话:13121318867

登录
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.0000
3
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子