Append and Prepend Characters in Python f-Strings

Python
A tip to quickly append and/or prepend multiple characters in f-strings.
Author

Ziyue Li

Published

December 28, 2022

text = "Demo"
print(f'{text:*<10}')
print(f'{text:*>10}')
print(f'{text:*^10}')
Demo******
******Demo
***Demo***