Horje
python how to find index of an element in a 2d list Code Example
python get index of item in 2d list
myList = [[1, 2], [3, 4], [5, 6]]


def index_2d(myList, v):
    for i, x in enumerate(myList):
        if v in x:
            return i, x.index(v)


print(index_2d(myList, 3))
# you get
# (1, 0)
python how to find index of an element in a 2d list
import numpy
arr_2D = numpy.array(...)
                  
for x, row in enumerate(arr_2D.tolist()):
	for y, cell in enumerate(row):
	cell_pos = (x, y)




Python

Related
list vs dictionary python Code Example list vs dictionary python Code Example
Python Armstrong Number Code Example Python Armstrong Number Code Example
pandas convert hex string to int Code Example pandas convert hex string to int Code Example
Can Selenium python Web driver helps to extract data from DB Code Example Can Selenium python Web driver helps to extract data from DB Code Example
python how to show package version Code Example python how to show package version Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8