Skip to content

Instantly share code, notes, and snippets.

@Resisty
Created September 17, 2020 13:35
Show Gist options
  • Save Resisty/6b66f7c69ba28e9573bdfdacb978f441 to your computer and use it in GitHub Desktop.
Save Resisty/6b66f7c69ba28e9573bdfdacb978f441 to your computer and use it in GitHub Desktop.
Divide list 'lst' into num-sized chunks
def chunks(lst, num):
""" Divide list 'lst' into num-sized chunks
"""
for i in range(0, len(lst), num):
yield lst[i: i+num]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment