Bitmask representation of integers

Peter Abel PeterAbel at gmx.net
Wed Oct 8 07:24:39 EDT 2003


Tonguç Yumruk <trooper at ttnet.net.tr> wrote in message news:<mailman.1065595274.17690.python-list at python.org>...
> Hi,
> 
> 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.
> 
> -- 
> Love, Respect, Linux
> ############################################################################
> > I've hacked the Xaw3d library to give you a Win95 like interface and it
> > is named Xaw95. You can replace your Xaw3d library.
> Oh God, this is so disgusting!
> 	-- seen on c.o.l.development.apps, about the "Win95 look-alike"
> ############################################################################
> Tongu  Yumruk
> 
> --

>>> a=255
>>> b=0xff
>>> c=int('FF',16)
>>> d=int('11111111',2)
>>> a,b,c,d
(255, 255, 255, 255)
>>> 

Regards
Peter




More information about the Python-list mailing list