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
| Name | Description |
|---|---|
| width | The total width of the returned string. |
| fillchar | One 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, "."))