== id is 小数据池

原文链接: http://www.cnblogs.com/wangkaiok/p/9870047.html
s1 = '太白'
s2 = '太白'
# print(s1 == s2)  # 值是否相等

# print(id(s1))  # 内存地址

# is 身份运算 判断的是内存地址是否相同

# 小数据池
i1 = -3
# int: -5 ~ 256 范围之内
# str: 满足一定得规则的字符串(详见博客https://www.cnblogs.com/jin-xin/articles/9439483.html)。
# 小数据池:
# 1,节省空间。
# 2,提高性能。

转载于:https://www.cnblogs.com/wangkaiok/p/9870047.html

猜你喜欢

转载自blog.csdn.net/weixin_30511107/article/details/94826651
id