[SciPy-user] Manipulating Bit-Masked Data

Bill Dandreta wjdandreta at att.net
Tue Dec 27 22:20:04 CST 2005


Rich Shepard wrote:

>I'm quite new to Python and haven't found any documentation on how to
>manipulate bits. 
>
See:

Python Library Reference
2.3.4.1 Bit-string Operations on Integer Types

Example:

 >>>x=0xffff
 >>>y=0x0001
 >>> hex(x^y) #x (exclusive or) y
'0xfffe'
 >>> hex(x&y) #x and y
'0x1'


Bill



More information about the SciPy-user mailing list