On Aug 24, 1:11 am, castironpi <[EMAIL PROTECTED]> wrote:
> 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', ~1
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.p
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', _
of using at
> little C as possible.
>
> In my quest I came across a need to pass a pair of sign extended two's
> complement bytes. After painfully reading the wikipedia article on
> what two's complement was, I then thought of how I would handle this
> in python. I don
n extended two's
complement bytes. After painfully reading the wikipedia article on
what two's complement was, I then thought of how I would handle this
in python. I don't really recall ever having to work in binary with
python, so I really am clueless on what to do.
I can feed pytho