find all elements in list python 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: how to find item in list python without indexnig
>>> ["foo", "bar", "baz"].index("bar")
1
Example 3: find all element in list python
indices = [i for i, x in enumerate(my_list) if x == "whatever"]