# encoding: utf-8
a = 89
b = 89
# 输出唯一标识
print(id(a),id(b))
# 对比唯一标识
print(a is b)
a = 89
b = 98
print(id(a),id(b))
print(a is b)
a = b
print(id(a),id(b))
print(a is b)
a = [1]
b = [1]
print(id(a),id(b))
print(a is b)
a = b
print(id(a),id(b))
print(a is b)
# 链状比较运算符
print(1 < 2 < 3)
print(2 < 1 < 3)
python | 运算符 | 比较运算符
最新推荐文章于 2024-01-08 11:30:38 发布