On Aug 23, 11:52 pm, "Adam W." <[EMAIL PROTECTED]> wrote: > On Aug 24, 12:23 am, castironpi <[EMAIL PROTECTED]> wrote: > > > Try this out. Does it come close to what you want? > > > import struct > > struct.pack( 'i', ~10 ) > > ~struct.unpack( 'i', _ )[ 0 ] > > > >>> import struct > > >>> struct.pack( 'i', ~10 ) > > '\xf5\xff\xff\xff' > > >>> ~struct.unpack( 'i', _ )[ 0 ] > > 10- Hide quoted text - > > > - Show quoted text - > > Humm, so how do you use it :P Let me give you some examples and then > you can run it through: > > 0b1111110010010000 or 0xFC90 Should equal -880 > 0b0000011111010000 or 0x07D0 Should equal +2000
In this case I look at: >>> struct.unpack( '>h', '\xfc\x90' )[0] -880 >>> struct.unpack( '>h', '\x07\xd0' )[0] 2000 -- http://mail.python.org/mailman/listinfo/python-list