Skip to content

Instantly share code, notes, and snippets.

@kerenskybr
Created September 22, 2020 01:18
Show Gist options
  • Save kerenskybr/7cbafcf2cb7932b20d922d833f32c49e to your computer and use it in GitHub Desktop.
Save kerenskybr/7cbafcf2cb7932b20d922d833f32c49e to your computer and use it in GitHub Desktop.
Divide a list in chunks from given size
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