目录

bitwise_or

通过np.bitwise_or()函数计算输入数组中整数二进制表示的相应位的按位OR运算。

例子 (Example)

import numpy as np 
a,b = 13,17 
print 'Binary equivalents of 13 and 17:' 
print bin(a), bin(b)  
print 'Bitwise OR of 13 and 17:' 
print np.bitwise_or(13, 17)

其输出如下 -

Binary equivalents of 13 and 17:
0b1101 0b10001
Bitwise OR of 13 and 17:
29

您可以使用下表验证此输出。 考虑以下按位OR真值表。

一个 要么
111
101
011
000
1101
AND
10001
result 11101

十进制等效于11101是29。

↑回到顶部↑
WIKI教程 @2018