SyntaxFix
Write A Post
Hire A Developer
Questions
As of Python 3.6 you can just do
>>> strng = 'hi' >>> f'{strng: <10}'
with literal string interpolation.
Or, if your padding size is in a variable, like this (thanks @Matt M.!):
>>> to_pad = 10 >>> f'{strng: <{to_pad}}'