Endianness conversion

Gabriel Genellina gagsl-py at yahoo.com.ar
Sat Feb 24 23:31:21 EST 2007


En Sat, 24 Feb 2007 14:27:12 -0300, Toby <etatoby at gmail.com> escribió:

> I ended up writing my own byteswapper in Pyrex:

You can use the byteswap method of arrays:

>>> import array
>>> a = array.array('H', 'ABcd56')
>>> a.tostring()
'ABcd56'
>>> a.byteswap()
>>> a.tostring()
'BAdc65'

-- 
Gabriel Genellina




More information about the Python-list mailing list