python get all indices of element in list code example
Example 1: get all indices of a value in list python
indices = [i for i, x in enumerate(my_list) if x == "whatever"]
Example 2: get index of all element in list python
indices = [i for i, x in enumerate(my_list) if x == "whatever"]