发布时间:2019-09-24 08:26:54编辑:auto阅读(2052)
算数运算:
比较运算:
赋值运算:
逻辑运算:
成员运算:
身份运算:
位运算:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/usr/bin/python a = 60 # 60 = 0011 1100 b = 13 # 13 = 0000 1101 c = 0 c = a & b; # 12 = 0000 1100 print "Line 1 - Value of c is " , c c = a | b; # 61 = 0011 1101 print "Line 2 - Value of c is " , c c = a ^ b; # 49 = 0011 0001 #相同为0,不同为1 print "Line 3 - Value of c is " , c c = ~a; # -61 = 1100 0011 print "Line 4 - Value of c is " , c c = a << 2 ; # 240 = 1111 0000 print "Line 5 - Value of c is " , c c = a >> 2 ; # 15 = 0000 1111 print "Line 6 - Value of c is " , c |
*按位取反运算规则(按位取反再加1) 详解http://blog.csdn.net/wenxinwukui234/article/details/42119265
运算符优先级:
更多内容:猛击这里
上一篇: python3 基础(5)-模块(1)-
下一篇: Day3 python基础
47776
46289
37179
34668
29261
25920
24807
19895
19455
17950
5747°
6351°
5865°
5916°
7017°
5852°
5878°
6384°
6342°
7712°