通过 np.bitwise_or()函数对输入数组中整数的二进制进行按位或运算。
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