PythonStringrjust

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

Syntax

str.rjust(width, fillchar?)

Example

Enter values below to update the example in real time.

print
rjust
text = "hi"
print(text.rjust(10))        # "        hi"
print(text.rjust(10, "0"))   # "00000000hi"