Fangwen Lu wrote:
> Dear all-
>  
> If I have an array array([1, 2, 3, 4, 5, 6]), and I want to get
> ((1,2),(3,4),(5,6)). What should I do?
>  

tuple([j for (i,j) in enumerate(zip(x, x[1:])) if i % 2 == 0])

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to