Formatting Strings

center(width): str

Returns a copy of this string centered in a field of the given width.

ljust(width): str

Returns a string left justified in a field of the given width.

rjust(width): str

Returns a string right justified in a field of the given width.

format(items): str

Formats a string.

>>> s = "Welcome"
>>> s1 = s.center(11)
>>> s1
' Welcome '
>>> s2 = s.ljust(11)
>>> s2
'Welcome '
>>> s3 = s.rjust(11)
>>> s3
' Welcome'
>>>