Skip to content

Instantly share code, notes, and snippets.

@nim4n136
Created March 19, 2020 15:46
Show Gist options
  • Save nim4n136/0c57943bc5cfd3d62cf99e8e3961d0e7 to your computer and use it in GitHub Desktop.
Save nim4n136/0c57943bc5cfd3d62cf99e8e3961d0e7 to your computer and use it in GitHub Desktop.
Chunk array python
# chunk data array
def chunks(lst, n_max):
n = max(1, n_max)
return (lst[i:i+n] for i in range(0, len(lst), n_max))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment