Following the Question: How to set the spaces in a string format in Python 3
Why does the first one work but the second one not?
string='Hello World!'
length = 20
print('{1:>{0}}'.format(length, string))
Results in: Hello World!
string='Hello World!'
length = len(string)
print('{1:>{0}}'.format(length, string))
Results in: Hello World!