码迷,mamicode.com
首页 > 编程语言 > 详细

python | 运算符 | 比较运算符

时间:2018-01-13 20:51:11      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:输出   标识   pre   post   pos   div   odi   python   nbsp   

 1 # encoding: utf-8
 2 
 3 a = 89
 4 b = 89
 5 # 输出唯一标识
 6 print(id(a),id(b))
 7 # 对比唯一标识
 8 print(a is b)
 9 a = 89
10 b = 98
11 print(id(a),id(b))
12 print(a is b)
13 a = b
14 print(id(a),id(b))
15 print(a is b)
16 
17 a = [1]
18 b = [1]
19 print(id(a),id(b))
20 print(a is b)
21 a = b
22 print(id(a),id(b))
23 print(a is b)
24 
25 # 链状比较运算符
26 print(1 < 2 < 3)
27 print(2 < 1 < 3)

 

python | 运算符 | 比较运算符

标签:输出   标识   pre   post   pos   div   odi   python   nbsp   

原文地址:https://www.cnblogs.com/yuzhen233/p/8280212.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!