Created
September 22, 2020 01:18
-
-
Save kerenskybr/7cbafcf2cb7932b20d922d833f32c49e to your computer and use it in GitHub Desktop.
Divide a list in chunks from given size
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 divide_chunks(a_list, chunk_size): | |
"""Divide a list in chunks from given size | |
""" | |
for i in range(0, len(a_list), chunk_size): | |
yield a_list[i:i + chunk_size] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment