import itertools
def group(lst):
return [list(x[1]) for x in itertools.groupby(lst)]
Saturday, October 25, 2008
99 problems - python - 9
Pack consecutive duplicates of list elements into sublists. If a list contains repeated elements they should be placed in separate sublists.
Labels:
99 problems,
python
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment