[docs] [issue23695] idiom for clustering a data series into n-length groups

Ethan Furman report at bugs.python.org
Wed Mar 18 02:00:03 CET 2015


Ethan Furman added the comment:

I think an example should suffice:

>>> s = [1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> n = 3
>>> zip(*[iter(s)]*n)
[(1, 2, 3), (4, 5, 6), (7, 8, 9)]

----------
nosy: +ethan.furman
versions:  -Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23695>
_______________________________________


More information about the docs mailing list