swapping numeric items in a list

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Aug 23 06:13:16 EDT 2006


In <mailman.9675.1156291509.27775.python-list at python.org>, Jiang Nutao
wrote:

> To convert list
>     aa = [0x12, 0x34, 0x56, 0x78]
> into
>     [0x34, 0x12, 0x78, 0x56]
> 
> How to do it fast? My real list is huge.

Use the `array` module and the `array.byteswap()` method.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list