(string, dict_)
return num
Convert string of letters to list of ints
Convert string of letters to list of ints
Convert string of letters to list of ints
def letter_to_num(string, dict_):
    """ Convert string of letters to list of ints """
    patt = re.compile('[' + ''.join(dict_.keys()) + ']')
    num_string = patt.sub(lambda m: dict_[m.group(0)] + ' ', string)
    num = [int(i) for i in num_string.split()]
    return num
def letter_to_num ( string , dict_ ) : patt = re . compile ( '[' + '' . join ( dict_ . keys ( ) ) + ']' ) num_string = patt . sub ( lambda m : dict_ [ m . group ( 0 ) ] + ' ' , string ) num = [ int ( i ) for i in num_string . split ( ) ] return num