>>>>> "Fredrik" == Fredrik Lundh <[EMAIL PROTECTED]> writes:
> if you want to XOR the bytes, you can do something like: > import array > b = array.array("B", a) > for i in range(len(b)): > b[i] = b[i] ^ 255 > b = b.tostring() > or > b = "".join([chr(ord(c) ^ 255) for c in a]) I wish python would soon get a byte array type. For now I find numarray to be very convenient to do stuff like this. import numarray b = (numarray.array(a, type = 'u1') ^ 255).tostring() It's also significantly faster for large byte array sizes. Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rganesan | http://rganesan.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list