Thanks. But the thing I need to swap is [0x12, 0x34, 0x56, 0x78], not [0x1234, 0x5678].
----- Original Message ----- From: "Gabriel Genellina" <[EMAIL PROTECTED]> To: "Jiang Nutao" <[EMAIL PROTECTED]> Cc: "Gabriel Genellina" <[EMAIL PROTECTED]>; <python-list@python.org> Sent: Wednesday, August 23, 2006 12:19 PM Subject: Re: swapping numeric items in a list > At Wednesday 23/8/2006 15:32, Jiang Nutao wrote: > >>This is what I got in the debugger: >> >>(Pdb) aa=array('b', [126, 55, 71, 112]) >>(Pdb) aa >>array('b', [126, 55, 71, 112]) >>(Pdb) aa.byteswap() >>(Pdb) aa >>array('b', [126, 55, 71, 112]) > > Oh, sorry, to swap by two bytes "H" was the right typecode. But your input > array should be: >>>> aa = array('H', [0x1234, 0x5678]) > which should give: > array('H', [0x3412, 0x7856]) > > > > Gabriel Genellina > Softlab SRL > > > > > __________________________________________________ > Preguntá. Respondé. Descubrí. > Todo lo que querías saber, y lo que ni imaginabas, > está en Yahoo! Respuestas (Beta). > ¡Probalo ya! http://www.yahoo.com.ar/respuestas > > -- http://mail.python.org/mailman/listinfo/python-list