Skip to content

Instantly share code, notes, and snippets.

@gjcourt
Last active December 24, 2015 23:19
Show Gist options
  • Save gjcourt/6879332 to your computer and use it in GitHub Desktop.
Save gjcourt/6879332 to your computer and use it in GitHub Desktop.
Partition a collection into bins of size K
def partiton(collection, size):
return zip(*[iter(collection)]*size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment