Python的移位运算符

Python的移位运算符

  1. 正整数的移位运算
#1. 正整数左移相当于乘以二
>>> 4<<1
8
>>> 4<<2
16

#2. 正整数右移相当于除以二
>>> 8>>1
4
>>

你可能感兴趣的:(Python,python)