Bitmask representation of integers
Miki Tebeka
tebeka at cs.bgu.ac.il
Wed Oct 8 08:50:57 EDT 2003
Hello Tonguç,
> I'm looking for a way to represent bit-level data in python. Something
> like 0xDEADBEEF representation, but not for hex i'm looking for binary.
> Something like the %00110101 representation I used in pascal... Of
> course I can make my operations with ordinary integers but binary
> representation makes the code easier to read.
Just use strings.
>>> int("101", 2)
5
>>>
HTH.
Miki
More information about the Python-list
mailing list