12 lines
238 B
Python
12 lines
238 B
Python
def chunker(it, n):
|
|
it = iter(it)
|
|
while 1:
|
|
chunk = tuple(x[1] for x in zip(range(n), it))
|
|
if not chunk:
|
|
break
|
|
yield chunk
|
|
|
|
|
|
for chunk in chunker(range(25), 4):
|
|
print(list(chunk))
|