Skip to content

Instantly share code, notes, and snippets.

@kurozumi

kurozumi/chunk.py

Last active Aug 25, 2016
Embed
What would you like to do?
【Python】PHPのarray_chunkをPythonで実装
def chunk(l, size):
for i in range(0, len(l), size):
yield l[i:i+size]
for l in chunk(range(0,100), 10):
print(list(l))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment