Jiang Nutao wrote: > 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.
Mark Rintsch's suggestion appears best if applicable, but just to cite yet other ways to do it : list(aa[j+(-1)**j] for j in range(len(aa))) or sum(reversed(zip(*[reversed(aa)]*2)),()) or (py 2.5) from itertools import izip ab = iter(aa) list((yield y) or x for x,y in izip(ab,ab)) -- http://mail.python.org/mailman/listinfo/python-list