Home > other >  Similar matlab bitget function in python? Access to a number of binary form one
Similar matlab bitget function in python? Access to a number of binary form one

Time:09-25

A=5, for example, is a unit8 number, binary form "00000101"
It is 1, 3 in matlab as long as the bitget (a, 3),
But as if no such function in python numpy library also does not have this kind of operation?
This kind of function of matlab in python need how to implement?

CodePudding user response:

Def bitget (number, pos) :
Return (number & gt;> Pos) & amp; 1
  • Related