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