[Twisted-Python] Big/Little-endian problem

Christopher Armstrong radix at twistedmatrix.com
Tue Apr 22 17:41:08 MDT 2008


On Tue, Apr 22, 2008 at 7:32 PM, Xian Chen <hoganxian at gmail.com> wrote:
> In Twisted, do the user need to take care of the big/little-endian issues?

The basic Twisted protocol system is purely in terms of bytes,
represented by the Python 'str' type.

> For example, I receive a buffer via UDP which actually represents a unsinged
> int value. So, how can i convert this buffer[0:1] to unsigned int ?

Check out the 'struct' Python module,
http://docs.python.org/lib/module-struct.html

-- 
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/




More information about the Twisted-Python mailing list