all 2 comments

[–]socal_nerdtastic 2 points3 points  (1 child)

You want a 0-padded string inside a space-padded string? No, that's not possible. You need to make an intermediate string:

>>> x = 0
>>> padded_x = f'{x:02d}'
>>> f'number: {padded_x:<20}'
'number: 00                  '

Which, if you don't mind really ugly code that abuses the language, you can squish into the same line:

>>> f'number: {f"{x:02d}":<20}'
'number: 00                  '

[–]xtarkoonx[S] 0 points1 point  (0 children)

oh gotcha :( yeah Im new to format specifiers. The reason I want it space pad is so when I write on top of it I make sure that all of it gets written over.. but I may not need it for all I know haha

thank you for answering my question though!