Python String ljust() Method

Last Updated : 31 Dec 2025

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

Syntax of Python String Ijust() 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 left justified string.

Different Examples for Python String Ijust() Method

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

Example 1

Let us take an example to demonstrate the ljust() method in Python.

Output:

Javatpoint          

Example 2

Let us take an example to demonstrate the ljust() method in Python.

Output:

Javatpoint$$$$$
 
Next TopicPython Strings