输入数组中整数的二进制按位与(and)运算由np.bitwise_and()函数计算。
import numpy as np print 'Binary equivalents of 13 and 17:' a,b=13,17 print bin(a), bin(b) print '\n' print 'Bitwise AND of 13 and 17:' print np.bitwise_and(13, 17)
其输出如下-
链接:https://www.learnfk.comhttps://www.learnfk.com/numpy/numpy-bitwise-and.html
来源:LearnFk无涯教程网
Binary equivalents of 13 and 17: 0b1101 0b10001 Bitwise AND of 13 and 17: 1
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)