无涯教程-NumPy - 左移运算符函数
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
numpy.left_shift()函数将数组元素的二进制向左移动指定位置,从右边追加等号0。
import numpy as np print 'Left shift of 10 by two positions:' print np.left_shift(10,2) print '\n' print 'Binary representation of 10:' print np.binary_repr(10, width=8) print '\n' print 'Binary representation of 40:' print np.binary_repr(40, width=8) # Two bits in '00001010' are shifted to left and two 0s appended from right.
其输出如下-
Left shift of 10 by two positions: 40 Binary representation of 10: 00001010 Binary representation of 40: 00101000
参考链接
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |