pythonExample100/JCP052.py

13 lines
234 B
Python
Raw Permalink Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

'''
题目:学习使用按位或 | 。
1.程序分析0|0=0; 0|1=1; 1|0=1; 1|1=1            
2.程序源代码:
'''
if __name__ == '__main__':
a = 077
b = a | 3
print 'a | b is %d' % b
b |= 7
print 'a | b is %d' % b