python tips
2011-01-11 21:07
127 查看
==比较内容相等性
is测试对象相等性
结果
X [1, 2, 3]
Y [1, 2, 3]
True
False
X [1, 2, 2]
Y [1, 2, 3]
is测试对象相等性
X=[1,2,3]; Y=X[:]; print('X',X); print('Y',Y); print(X==Y); print(X is Y); X[2]=2; print('X',X); print('Y',Y);
结果
X [1, 2, 3]
Y [1, 2, 3]
True
False
X [1, 2, 2]
Y [1, 2, 3]
相关文章推荐
- Python学习笔记-tips: 什么是*args和**kwargs?
- python tips
- Python Tips (1)
- Python tips: 什么是*args和**kwargs?
- python tips:列表推导
- [Python Tips]如何找出Python list中有重复的项
- [Python Tips]去除 Trivial 赋值语句
- Python tips: 什么是*args和**kwargs?
- python tips
- Python tips: 什么是*args和**kwargs?
- PythonTips1
- some tips about python Six
- [Dynamic Language] Python Tips
- Python codecs小Tips
- python time 转换&运算tips
- python tips
- 学习Python的一些Tips
- [tips]PythonMagick的安装
- python tips(2)
- python tips(4)