from more_itertools import chunked iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8] list(chunked(iterable, 3))