[Tutor] working with bit arrays

Robert Berman bermanrl at cfl.rr.com
Wed Dec 2 19:08:03 CET 2009


I am trying to represent a number as a list of bits: for example the bit
representation of the integer 8. I did find a number of articles
pertaining to a module called bitarray but I was unable to
download/install that package. I am using Linux on Ubuntu 9.10; Python

I am almost certain there is a relatively easy way to convert an integer
that can be represented by 32 bits into an array of bits that I can
iterate over looking for switched on bits or switched off bits. 

Any information such as recipes or past articles in this list providing
methods to create and manipulate  bit arrays would be most appreciated.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091202/52214535/attachment.htm>

More information about the Tutor mailing list