swapping numeric items in a list

Gabriel Genellina gagsl-py at yahoo.com.ar
Wed Aug 23 15:19:33 EDT 2006


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




More information about the Python-list mailing list