bitwise operator example

2015-11-04 0 880
bitwise operator example
>>> def b(n): print('{:08b}'.format(n))

>>> b(5)
00000101
>>> x, y = 0x55, 0xaa
>>> b(x)
01010101
>>> b(y)
10101010
>>> b(x|y)
11111111
>>> b(x&y)
00000000
>>> b(x^y)
11111111
>>> b(x^0)
01010101
>>> b(x<<4)
10101010000
>>> b(x>>4)
00000101
>>> b(~x)
-1010110

遇见资源网 python bitwise operator example http://www.ox520.com/15865.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务