swapping numeric items in a list
Jiang Nutao
jiangnutao at gmail.com
Wed Aug 23 14:32:50 EDT 2006
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])
----- Original Message -----
From: "Gabriel Genellina" <gagsl-py at yahoo.com.ar>
To: "Jiang Nutao" <jiangnutao at gmail.com>
Cc: <python-list at python.org>
Sent: Wednesday, August 23, 2006 11:28 AM
Subject: Re: swapping numeric items in a list
> At Wednesday 23/8/2006 14:44, Jiang Nutao wrote:
>
>>array.byteswap() won't work for me easily. I tried this before my 1st
>>post.
>>I defined
>>
>> aa = array('H', [0x12, 0x34, 0x56, 0x78])
>>
>>Then did byteswap aa.byteswap(). The result was
>>
>> array('H', [0x1200, 0x3400, 0x5600, 0x7800])
>>
>>You can see it byteswapped within each item.
>
> Use array('b') or 'B'. 'H' are two-byes integers.
>
>
>
> 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
>
>
More information about the Python-list
mailing list