Multiple lists in python

How can i get the index of a single value in mutiple list
Here , how can i get the index of ’ 4 ’

for x in s:
    for index, value  in enumerate(x):
        if value == '4':


You access the first list 0, and the second element inside that first list 1.

To get the index of ‘4’ or any other element , here is the code

for x,y in enumerate(s):
    for index, value  in enumerate(y):
        if value == '4':

The position of ‘4’ is 0,1 which means it is at ist position in 0th element.

Checkout this basic tutorial on Python to know more


  • the index of ‘4’ = s[0].index(‘4’) = 1
  • the index of ‘3’ = s[1].index(‘3’) = 2
  • the index of [‘1’, ‘4’] = s.index([‘1’, ‘4’]) = 0

In general:
the index of an item x in a list a_list is: a_list.index(x)