integer to binary...
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Fri Jun 2 19:53:43 EDT 2006
nicolasg at gmail.com a écrit :
> does anyone know a module or something to convert numbers like integer
> to binary format ?
>
> for example I want to convert number 7 to 0111 so I can make some
> bitwise operations...
You don't need to convert anything. The bitwise ops are &, |, <<, >>
0 | 2 | 4
-> 6
6 & 2
-> 2
2 << 4
-> 32
8 >> 1
-> 4
More information about the Python-list
mailing list