Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
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]

Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
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" <[EMAIL PROTECTED

Re: swapping numeric items in a list

2006-08-23 Thread Jiang Nutao
aa.byteswap(). The result was array('H', [0x1200, 0x3400, 0x5600, 0x7800]) You can see it byteswapped within each item. Jason "Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In <[EMAIL PROTECTED]>, Jiang Nutao

swapping numeric items in a list

2006-08-22 Thread Jiang Nutao
Hi, I simplify my problem like below To convert list aa = [0x12, 0x34, 0x56, 0x78] into [0x34, 0x12, 0x78, 0x56] How to do it fast? My real list is huge. Thanks a lot. Jason -- http://mail.python.org/mailman/listinfo/python-list