You need to place key
and group
in parenthesis:
for index, (key, group) in enumerate(itertools.groupby(myList, myFunc)):
Below is a demonstration:
>>> # lst represents what is returned by itertools.groupby
>>> lst = [(1, 2), (3, 4), (5, 6)]
>>> for i, (j, k) in enumerate(lst):
... i, j, k
...
(0, 1, 2)
(1, 3, 4)
(2, 5, 6)
>>>