def decode ( string , base ) : base = int ( base ) code_string = get_code_string ( base ) result = 0 if base == 16 : string = string . lower ( ) while len ( string ) > 0 : result *= base result += code_string . find ( string [ 0 ] ) string = string [ 1 : ] return result
how to get the base 10value for a string in python
Given a string ( string ) and a numeric base ( base ) decode the string into an integer .
def decode(string, base):
    """
    Given a string (string) and a numeric base (base),
    decode the string into an integer.

    Returns the integer
    """

    base = int(base)
    code_string = get_code_string(base)
    result = 0
    if base == 16:
        string = string.lower()
    while len(string) > 0:
        result *= base
        result += code_string.find(string[0])
        string = string[1:]
    return result