Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
4-liner: Done using chain & zip solution in Speedy category for Chunk by Stensen
from itertools import chain
def chunking_by(items, step):
temp = zip(chain([0], range(0, len(items), step)), chain(range(0, len(items), step), [None]))
return list(items[i:j] for i, j in temp if items[i:j])
Oct. 24, 2020
Comments: