Say I want the index of a list, with sublists, of the sublist with the first item as 3: therefore I want index of 2. Ideally I could use index:
mylist = [[1,3],[2,2],[3,7]]
# Sadly this is not possible:
i = mylist.index(3, key = lambda x: x[0])
>>> 2
But sadly index method does not support a key parameter. Are there any pythonic functions which can do the same job?