Le mercredi 14 février 2007 13:08, amadain a écrit :
> darr=list("010203040506")
> aarr=darr[:2]
> barr=darr[4:6]
> darr[:2]=barr
> darr[4:6]=aarr
> result="".join(darr)
>
> The above code works fine but I was wondering if anybody had another
> way of doing this?

Why not :

In [4]: s="010203040506"

In [5]: print s[4:6] + s[2:4] + s[0:2] + s[6:]
030201040506

?

-- 
_____________

Maric Michaud
_____________

Aristote - www.aristote.info
3 place des tapis
69004 Lyon
Tel: +33 426 880 097
Mobile: +33 632 77 00 21
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to