Given a list [\"foo\", \"bar\", \"baz\"] and an item in the list \"bar\", how do I get its index (1) in Python?
[\"foo\", \"bar\", \"baz\"]
\"bar\"
1
Simply you can go with
a = [['hand', 'head'], ['phone', 'wallet'], ['lost', 'stock']] b = ['phone', 'lost'] res = [[x[0] for x in a].index(y) for y in b]