Last active
August 25, 2016 10:55
-
-
Save kurozumi/975655ab36b882e80a8ef4878677deab to your computer and use it in GitHub Desktop.
【Python】PHPのarray_chunkをPythonで実装
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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