Skip to content
String Methods

ljust()

Pad the right side so text reaches a chosen width.

str.ljust(width, fillchar=' ')

Pad the right 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 left-justified string, padded to the requested width.

Try it

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

Related entries