Python groupby Iterator


Python groupby(data[,keyfunc]) iterator divide the data into groups based on duplication or not.

>>> from itertools import *
>>> for i, j in groupby('55333--3399'):
>>> 	print (i,list(j))
5 ['5', '5']
3 ['3', '3', '3']
- ['-', '-']
3 ['3', '3']
9 ['9', '9']