I have a list that contains many lists with a fixed number of elements:
info = [['N', 100, 'A'], ['O', 99, 'A'], ['C', 105, 'A'], ...]
I want to find the index of the element that contains 'N'
and 100
, namely 0
. I tried something like this to get the element itself:
matches = [a for name in a[2] and resnum in a[5] for a in info]
which didn't work. Is there a way to do this with list comprehensions?