Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

parameterized formatter



def formatter(value, filler, width):
    return "{var:{fill}>{width}}".format(var=value, fill=filler, width=width)

text = formatter(23, "0", 7)
print(text)


print(formatter(42, " ", 7))
print(formatter(1234567, " ", 7))
0000023
     42
1234567