Here We right-align (rjust) a string with spaces. Then we left-align (ljust) a number with star characters.
Python program that uses format padding
# Right-align a string in 10 chars.# ... First char in format string is a space.
value = format("line 1", " >10s")
# Left-align a number in 10 chars.# ... Pad with a star character.
print(format(100, "*<10d")) line 1
Some notes, loop. Consider this—a loop could be used to pad strings. This can be needed for more complex requirements. Continue adding characters until the desired length is met.