⬅︎ Back to How to pad/fill a string by a variable in Python using f-strings
Okay, how about this: >>> name = 'peter' >>> filler = '*' >>> length = 10 >>> f = f'{filler}<{length}' >>> f'{name:{f}}' 'peter*****'
Comment
Okay, how about this:
>>> name = 'peter'
>>> filler = '*'
>>> length = 10
>>> f = f'{filler}<{length}'
>>> f'{name:{f}}'
'peter*****'