simple example of bit manipulation in python?

Alex Martelli aleax at aleax.it
Thu Aug 16 18:05:14 CEST 2001


"Thomas Weholt" <thomas at gatsoft.no> wrote in message
news:ODLe7.864$y9k.170724864 at news.telia.no...
> Hi,
>
> Can anobody point to or provide a simple example of bit manipulation using
> plain python?

You mean "bit manipulation" as in:

>>> x=0xdeadbeef
>>> low=0xFFFF
>>> "%x"%(x&low)
'beef'
>>> "%x"%(x>>16&low)
'dead'
>>>

or what?


Alex






More information about the Python-list mailing list