I have this dictionary_pair and a list_value. I want to be able to use lambda, filter to get a list as [1,2]. I have tried the code below but getting a list as ['ab'].
dictionary_pair = {'ab': [1, 2], 'cd': [3, 1]}
list_value = ['ab', 'yz']
try:
result = list(filter(lambda x: dictionary_pair[x], list_value))
except KeyError:
pass