Skip to content

Instantly share code, notes, and snippets.

@arc279
Created February 6, 2019 07:22
Show Gist options
  • Select an option

  • Save arc279/d864de7089254bfd11d410b60a6203d3 to your computer and use it in GitHub Desktop.

Select an option

Save arc279/d864de7089254bfd11d410b60a6203d3 to your computer and use it in GitHub Desktop.
import itertools
def each_slice(n, seq):
args = [iter(seq)] * n
return itertools.zip_longest(fillvalue=None, *args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment