Grouping lists

PyPK superprad at gmail.com
Fri Sep 9 19:01:44 CEST 2005


If I have a list say

lst = [1,1,1,1,3,5,1,1,1,1,7,7,7]
I want to group the list so that it returns groups such as
[(0,3),4,5,(6,9),(10,12)]. which defines the regions which are similar.

Thanks,




More information about the Python-list mailing list