== 判断字面值是否相等
>>> x = 10
>>> y = 10
>>> x == y
True
>>> a = "tom"
>>> b = "tom"
>>> a == b
True
is 判断引用对象地址是否相同
>>> x = 10
>>> y = 10
>>> x is y
True
>>> a = "tom"
>>> b = "tom"
>>> a is b
True
0~255 Python 自动缓存(8bit位 1个字符)(方便策略)
短字符串也可能被放缓存
>>> x = 1000
>>> y = 1000
>>> x == y
True
>>> x is y
False
>>> peter = "www.baidu.com"
>>> queena = "www.baidu.com"
>>> peter is queena
False
>>> peter == queena
True
id(obj)检测对象地址
>>> id(x)
10251040
>>> id(y)
10251064
>>> id(peter)
140585861478696
>>> id(queena)
140585861478752