ReferenceString methods
str.rjust()
Pads on the left so the text sits at the right of the given width.
Signature
text.rjust(width, fillchar=' ')Parameters
| Name | Means |
|---|---|
width | the total length wanted |
fillchar | what to pad with |
Returns
A new string.
Example
Python
print("ab".rjust(6, ".") + "|")
print("ab".ljust(6, ".") + "|")
print("ab".center(6, ".") + "|")Output
....ab| ab....| ..ab..|