Grouping lists

PyPK superprad at
Mon Sep 12 17:23:37 CEST 2005

hmm thanks for that..but kind of not sure how this groupby works.. also
if I want to group elements with one value apart how would this
change.Should this change in groupby part or in the loop?
something like...
lst = [1,1,2,1,3,5,1,1,1,1,2,7,7]
returns (0,3),4,5,(6,10),(11,12)
so its something like if there is 1,1,2 then the grouping is done..
I am asking this as I could not quit follow what exactly groupby does..

Also if someone could explain me what exactly this groupby is doing
that would be helpful.

Thanks again.

More information about the Python-list mailing list