python split list in chunks of size code example
Example: split into list into even chunks
def chunks(l, n):
n = max(1, n)
return (l[i:i+n] for i in range(0, len(l), n))
def chunks(l, n):
n = max(1, n)
return (l[i:i+n] for i in range(0, len(l), n))