Can you create a f-string where you use a integer variable for the digits of padding?
>>> s = 8
>>> f"{'test':s}"
With .format() you could solve this doing something like:
>>> "{{:{}}}".format(s).format("test")
I'd use it for printing a list of names, padded by max name length:
s = max(map(len, names))
for n in names:
print(f"The age of {n:s} is {ages[n]}.")
n, s = "test", 8; f'{n:{s}}'->'test 'str.formatto do the same with it:"{:{}}".format(n, s)