You can find the index of the first element with the specified value in list in Python by following the given step. If you want to learn Python then I will highly recommend you to read This Book.
Index method is used to find the index of the first element with the specified value in list in Python. In the following example, I will find the index of integer ‘2’ in the list.
a = [1,2,2,3,2,4,5,2,1] print(a) print(a.index(2))
Example: In case of String
a = ['a','b','f','b','g','f','m'] print(a.index('f'))