(val, charset)
return output[::-1]
Turn a non-negative integer into a string.
Turn a non-negative integer into a string.
Turn a non - negative integer into a string .
def int_to_charset(val, charset):
    """ Turn a non-negative integer into a string.
    """
    if not val >= 0:
        raise ValueError('"val" must be a non-negative integer.')
    if val == 0: return charset[0]
    output = ""
    while val > 0:
        val, digit = divmod(val, len(charset))
        output += charset[digit]
    # reverse the characters in the output and return
    return output[::-1]
def int_to_charset ( val , charset ) : if not val >= 0 : raise ValueError ( '"val" must be a non-negative integer.' ) if val == 0 : return charset [ 0 ] output = "" while val > 0 : val , digit = divmod ( val , len ( charset ) ) output += charset [ digit ] # reverse the characters in the output and return return output [ : : - 1 ]