utensil
Yield successive n-sized chunks from lst.
>>> for chunk in chunks([1, 2, 3, 4, 5], 2): ... print(chunk) [1, 2] [3, 4] [5]
>>> for chunk in chunks(range(5), 2): ... print(chunk) [0, 1] [2, 3] [4]
>>> for chunk in chunks(range(5), 0): ... print(chunk)
previous
Welcome to utensil’s documentation!
next
utensil.constant package