0

我刚开始学习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

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

4

0 回答 0