is用来判断两个变量引用对象是否为同一个
==用来判断引用变量的值是否相等
>>> a = [1, 2, 3] >>> b = a >>> b is a True >>> b == a True >>> b = a[:] #b=[1,2,3] >>> b is a False >>> b == a True脚本模式与交互模式不一样,与数值大小和变量是否在同一行有关
is用来判断两个变量引用对象是否为同一个
==用来判断引用变量的值是否相等
>>> a = [1, 2, 3] >>> b = a >>> b is a True >>> b == a True >>> b = a[:] #b=[1,2,3] >>> b is a False >>> b == a True脚本模式与交互模式不一样,与数值大小和变量是否在同一行有关