Skip to content

Instantly share code, notes, and snippets.

@alexeygrigorev
Created August 13, 2020 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexeygrigorev/3a9ae7eb692be0069278254297ce036e to your computer and use it in GitHub Desktop.
Save alexeygrigorev/3a9ae7eb692be0069278254297ce036e to your computer and use it in GitHub Desktop.
def make_batches(seq, n):
result = []
for i in range(0, len(seq), n):
batch = seq[i:i+n]
result.append(batch)
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment