May 10, 2021 Python2
Scene:
String alignment
python provides an easy way to align strings
>>> print("abc".center (30,'-'))
-------------abc--------------
>>> print("abc".ljust (30)+'|')
abc |
>>> print("abc".rjust (30))
abc
>>>
They are center, ljust, rjust
The three methods are spaces by default, or they can be filled with other characters