Python 练习范例 52
学习使用按位或 |
分析
0|0=0; 0|1=1; 1|0=1; 1|1=1
#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = 077 b = a | 3 print 'a | b is %d' % b b |= 7 print 'a | b is %d' % b
以上 Python 代码输出结果如下
a | b is 63 a | b is 63
学习使用按位或 |
0|0=0; 0|1=1; 1|0=1; 1|1=1
#!/usr/bin/python # -*- coding: UTF-8 -*- if __name__ == '__main__': a = 077 b = a | 3 print 'a | b is %d' % b b |= 7 print 'a | b is %d' % b
以上 Python 代码输出结果如下
a | b is 63 a | b is 63
♥ 简单教程,简单编程 - IT 入门首选站
Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.