python get index from list code example
Example 1: get index of list python
list.index(element)
Example 2: python index method
my_string = "Hello World!"
my_string.index("l")
Example 3: python get index and value from list
test = [ 'test 1', 'test 2', 'test 3' ]
for index, value in enumerate( test ):
print( index, value )
Example 4: find index of elem list python
indexPos = listOfElems.index('Ok')
print('First index of element "Ok" in the list : ', indexPos)
Example 5: how to index lists in python
list = ['bananas', 'apples', 'watermellon']
print(list[1])
Example 6: how to find index of list of list in python
[(i, colour.index(c))
for i, colour in enumerate(colours)
if c in colour]