Skip to content

Instantly share code, notes, and snippets.

# chunkify_list( list(xrange(1, 11), 2 ) -> ([1,2], [3,4], [5,6], [7,8], [9,10])
def chunkify_list(L, size):
while L:
chunk, L = L[:size], L[size:]
yield chunk