breaking up a list

C Gillespie csgcsg39 at hotmail.com
Tue Sep 28 07:04:55 EDT 2004


Dear All,

If I have a list, say

x=[1,2,3,4,5,6]

What's the best way of converting it into this: [[1, 2], [3, 4], [5, 6]],
i.e. splitting it into pairs.

Many thanks

Colin





More information about the Python-list mailing list