Suppose I have the following list:
l = [1, 2, 3, 4, 5, 6, 7, 8, 9]
Is there a one-liner that could be used to break this up into a list of n_chunks. For example:
chunk(l, 3)
[[1,2,3],[4,5,6],[7,8,9]]
So far I have:
>>> [l[len(l)*i//3:] for i in range(3)]
[[1, 2, 3, 4, 5, 6, 7, 8, 9], [4, 5, 6, 7, 8, 9], [7, 8, 9]]
Which works for the 'left side' of the range but not the right side.