From author
You can find many interesting articles on my website, please visit it Happy Python Website
Look, here is the usual f-string
text = 'JUPI'
print(f'{text}')
JUPI
If I add to it
- colon,
- placeholder char,
- and I will specify the required string length using the <
print(f'{text:-<15}')
Then the rest of the line that is not occupied by the text will be filled with the selected character:
JUPI-----------
If you specify the length of the string via >, then you can fill in the line on the left side:
print(f'{text:->15}')
-----------JUPI
Write in the comments how to fill in the line on both sides so that it turns out
-----JUPI------
Top comments (0)