python http://stackoverflow.com/questions/306313/pythons-is-operator-behaves-unexpectedly-with-integ

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python http://stackoverflow.com/questions/306313/pythons-is-operator-behaves-unexpectedly-with-integ相关的知识,希望对你有一定的参考价值。

>>> a = 'wata'
>>> b = 'wata'
>>> a is b
True

>>> a = 'wat?'
>>> b = 'wat?'
>>> a is b
False

>>> a, b = 'wat?', 'wat?'
>>> a is b
True

>>> a = 'wat?'; b = 'wat?'
>>> a is b
True
>>> d = {'a':1,' b': 'asdf'}
>>> dd = dict(d)
>>> d is dd
False
>>> l = [1,'2']
>>> ll = list(l)
>>> l is ll
False
>>> t = (1,'2')
>>> tt = tuple(t)
>>> t is tt
True
>>> i = 1
>>> ii = int(i)
>>> i is ii
True
>>> s = 's'
>>> ss = str(s)
>>> s is ss
True
>>>

以上是关于python http://stackoverflow.com/questions/306313/pythons-is-operator-behaves-unexpectedly-with-integ的主要内容,如果未能解决你的问题,请参考以下文章

代写python,代写python编程,python代写,python编程代写,留学生python代写

001--python全栈--基础知识--python安装

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python

Python 介绍