Having a list like this
lst = ['a','b','a','c','a','b','b']
I'd like to get lists of indexes for each unique element to get this:
indexes = {
'a': [0,2,4],
'b': [1,5,6],
'c': [3]
}
This is my current code, but I'm only getting the first index of each element.
indexes= dict()
for el in lst:
indexes[el] = [lst.index(el)]
>>> indexes
{'a': [0], 'b': [1], 'c': [3]}
Thanks for any help.