Created
September 17, 2020 13:35
-
-
Save Resisty/6b66f7c69ba28e9573bdfdacb978f441 to your computer and use it in GitHub Desktop.
Divide list 'lst' into num-sized chunks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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