signed to unsigned

Brad Tilley kj4eit at
Fri Feb 17 20:10:36 CET 2012

> Pack it as the actual type, then unpack it as the desired type:
> Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
> Type "help", "copyright", "credits" or "license" for more information.>>> from struct import pack, unpack
> >>> unpack('=I', pack('=i',-327681234))
> (3967286062,)
> I would think there's some more efficient way to do this though.
> Cheers,
> Chris

Thanks Chris! I was doing it backwards. I only have a few of these
right now, so performance isn't a concern. I appreciate the advice.


More information about the Python-list mailing list