Python String rjust() Method Syntax

Syntax: string.rjust(length, fillchar)

Parameters:

  • length: length of the modified string. If length is less than or equal to the length of the original string then original string is returned.
  • fillchar: (optional) characters which needs to be padded. If it’s not provided, space is taken as a default argument.

Return: Returns a new string of given length after substituting a given character in left side of original string.

Python String rjust() Method

Python String rjust() method returns a new string of a given length after substituting a given character on the left side of the original string.

Similar Reads

Python String rjust() Method Syntax

Syntax: string.rjust(length, fillchar) Parameters: length: length of the modified string. If length is less than or equal to the length of the original string then original string is returned. fillchar: (optional) characters which needs to be padded. If it’s not provided, space is taken as a default argument. Return: Returns a new string of given length after substituting a given character in left side of original string....

Python String rjust() Method Example

Python3 string = 'geeks' length = 8 print(string.rjust(length))...