Let's say I have:
ref = ['<var>', '<id>', '<expr>']
val = [['a', 'b', 'c'], 'a', '1+1']
dicio = dict(zip(ref, val))
now, I know that by doing
list(dicio.keys())[list(dicio.values()).index('a')]
It returns <id>
. But let's say that you only had one value associated per key, so
val = [['a', 'b', 'c'], 'b', '1+1']
How could I get <var>
without listing ['a', 'b', 'c']
?
Thank you.