Skip to main content
 首页 » 编程设计

python之为什么 [] is [] 在 Python 中给出 False

2025年05月04日16freeliver54

<分区>

我对这个逻辑有点困惑。当以下在 python 中给出 True 时

print('' is '')  #True 
print('' == '')  #True 
print([] ==  []) #True 
print({} ==  {}) #True 

但为什么这些语句会给出 False?

print([] is  []) #False 
print({} is  {}) #False