I have a dictionary containing lists like
char_code = {'1':['b','f','v','p'],'2':['c','g','j','k','q','s','x','z'], '3':['d','t'], '4':['l'],'5':['m','n'], '6':['r']}
I have another list containing characters
word_list = ['r', 'v', 'p', 'c']
I want to replace the letters in word_list with keys in the dictionary so that it should become
['6', '1', '1', '2']
I tried some thing like
word_list[:]=[char_code.get(e,'') for e in word_list]