Possible Duplicate:
How do you split a list into evenly sized chunks in Python?
The idea is quite simple, I want to do something like this:
for elem1, elem2, elem3 in list:
<some code>
For this to work we need that list would be a list of 3-iterables, something like this:
list = [[1, 2, 3], [4, 5, 6]]
But, what can I do if this list is just a regular list?
list = [1, 2, 3, 4, 5, 6]
Is there any fast and simple way of transform this regular list into the list of 3-iterables so the loop would work? Or n-iterables, I use 3 here just as an example.
Thanks.