Ways To Align Text Strings In Python
In this article, I’ll show you various ways to align strings in Python. There are many different ways we can align strings in Python. Let’s have a look at those:
For left-aligned text, you can use ljust(…) function, which stands for left justification.
my_text = “Shift me.”
The above lines will display left-aligned text with a length of 25.