Skip to content
String Methods

rjust()

Pad the left side so text reaches a chosen width.

str.rjust(width, fillchar=' ')

Pad the left side so text reaches a chosen width.

Parameters

NameDescription
widthThe total width of the returned string.
fillcharOne character to use for padding; it defaults to a space.

Returns

A right-justified string, padded to the requested width.

Try it

Run it and change it
word = "cat"
print(word.rjust(6, "."))

Related entries