somepeople

is&==

is:判断两个变量的id是否相等

 

==:判断两个变量的值是否相等

>>> s1 = 'ryan is my hero'
>>> s2 = 'ryan is my hero'
>>> print(s1==s2)
True
>>> print(id(s1),id(s2))
1499122832304 1499122840432

 >>> print(s1 is s2)
 False

 

posted on 2021-01-12 23:41  Hello_Thanos  阅读(80)  评论(0编辑  收藏  举报

导航