I have a list1 of values:
['A','B','C','D'] And I have a dict
{1: ['A','F'],2:['B','J'],3:['C','N'],4:['D','X']} I would like to obtain the key for every value in the list:
I tried :
[dict1[x] for x in list] However ouputs an error because I am not considering the fact the dict value is a list not a single value. How could I achieve this?
My desired output would be a list with the keys of the list1 values:
[1,2,3,4]