1def chunks(lst, n):
2 """Yield successive n-sized chunks from lst."""
3 for i in range(0, len(lst), n):
4 yield lst[i:i + n]
5
6list(chunks(range(10, 75), 10))
1def split(a, n):
2 k, m = divmod(len(a), n)
3 return (a[i*k+min(i, m):(i+1)*k+min(i+1, m)] for i in range(n))