I am looking to transform a list into smaller lists of equal values. An example I have is:
[\"a\", \"a\", \"a\", \"b\", \"b\", \"c\", \"c\", \"c\", \"c\"]
<
You could use itertools.groupby to solve the problem:
>>> from itertools import groupby
>>> [list(grp) for k, grp in groupby(["a", "a", "a", "b", "b", "c", "c", "c", "c"])]
[['a', 'a', 'a'], ['b', 'b'], ['c', 'c', 'c', 'c']]
It only groups consecutive equal elements but that seems enough in your case.