Python String rjust() Method

Last Updated : 31 Dec 2025

Python rjust() method right justify the string and fill the remaining spaces with fillchars. This method returns a new string justified right and filled with fillchars.

Syntax of Python String rjust() Method

It has the following syntax:

Parameters

  • width: width of the given string.
  • fillchar: characters to fill the remaining space in the string. It is optional.

Return

It returns a right justified string.

Different Examples for Python String rjust() Method

Let's see some examples of rjust() method to understand it's functionalities.

Example 1

Here, we are going to take an example to demonstrate the Python String rjust() Method.

Output:

           javapoint

Example 2

Here, we are going to take an example to demonstrate the Python String rjust() Method.

Output:

$$$$$javapoint
 
Next TopicPython Strings