Python allows easy creation of an integer from a string of a given base via
int(str, base).
I want to perform the inverse: creati
def base_conversion(num, base): digits = [] while num > 0: num, remainder = divmod(num, base) digits.append(remainder) return digits[::-1]