def base62_decode(string, alphabet=ALPHABET):
 base = len(alphabet)
 strlen = len(string)
 num = 0
 idx = 0
 for char in string:
  power = (strlen - (idx + 1))
  num += (alphabet.index(char) * (base ** power))
  idx += 1
 return num

def base62_decode ( string , alphabet = ALPHABET ) : base = len ( alphabet ) strlen = len ( string ) num = 0 idx = 0 for char in string : power = ( strlen - ( idx + 1 ) ) num += ( alphabet . index ( char ) * ( base ** power ) ) idx += 1 return num
decode a base x encoded string into the number arguments: - string: the encoded string - alphabet: the alphabet to use for encoding .