Python概念查询

时间:2013-06-18 14:12:31

标签: python

我刚开始学习Python。我遇到了问题。请清楚我的怀疑。

a='abc'
b='abc'
a==b                 #When I run this O/P is True. But, in C/C++ or Java it turns out to be False because the variables(a & b) refer to different memories.

a is b               #When I run this O/P is True. Ok understood , but.....

但是

a=[1,2,3]
b=[1,2,3]
a==b                #The out put is True

a is b              #THe output is False

在字符串和列表的情况下,两个不同输出的原因是什么?

0 个答案:

没有答案