NumPy 二进制位或运算符 用于输入数组中整数的二进制表示的相应位的位或运算由 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) PythonCopy 它的输出如下: Binary equivalents of 13 and 17: 0b1101 0b10001 Bitwise OR of 13 and 17: 29 PythonCopy 您可以使用以下表格验证此输出。请考虑以下按位或真值表。 11101的十进制等效值是29。