I am trying to get the index of an element in nested lists in python - for example [[a, b, c], [d, e, f], [g,h]]
(not all lists are the same size).
I have tried
does this suffice?
array = [['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h']]
for subarray in array:
if 'a' in subarray:
print(array.index(subarray), '-', subarray.index('a'))
This will return 0 - 0. First zero is the index of the subarray inside array, and the last zero is the 'a' index inside subarray.