mirror of
https://github.com/python/cpython.git
synced 2025-11-13 15:40:05 +00:00
Make it easier to search for the grouper() recipe.
This commit is contained in:
parent
86a20f834a
commit
9ae9473389
1 changed files with 2 additions and 1 deletions
|
|
@ -705,7 +705,8 @@ which incur interpreter overhead.
|
||||||
return zip(a, b)
|
return zip(a, b)
|
||||||
|
|
||||||
def grouper(n, iterable, fillvalue=None):
|
def grouper(n, iterable, fillvalue=None):
|
||||||
"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
|
"Collect data into fixed-length chunks or blocks"
|
||||||
|
# grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
|
||||||
args = [iter(iterable)] * n
|
args = [iter(iterable)] * n
|
||||||
return zip_longest(*args, fillvalue=fillvalue)
|
return zip_longest(*args, fillvalue=fillvalue)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue