def stringint(k, n):
    """ returns string of integer k with n zeros padding
    (by placing zeros before to have n characters)

    :param k: integer to convert
    :param n: nb of digits for zero padding

    :return: string of length n containing integer k

    Example: 1 -> '0001'

    15 -> '0015'
    """
    encodingdigits = '{' + ':0{}'.format(int(n)) + '}'
    res = encodingdigits % k
    return res
