Skip to content

Instantly share code, notes, and snippets.

@maxtortime
Created August 5, 2016 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxtortime/8d57833cf4299b06a9b5ed867de74ecf to your computer and use it in GitHub Desktop.
Save maxtortime/8d57833cf4299b06a9b5ed867de74ecf to your computer and use it in GitHub Desktop.
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i + n]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment