Python elegant inverse function of int(string,base)
- by random guy
python allows conversions from string to integer using any base in the range [2,36] using:
int(string,base)
im looking for an elegant inverse function that takes an integer and a base and returns a string
for example
>>> str_base(224,15)
'ee'
i have the following solution:
def digit_to_char(digit):
if digit < 10: return…