def group(s, n): # See http://www.python.org/doc/2.6/library/functions.html#zip return list(zip(*[iter(s)]*n))