C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Python String ljust() MethodPython 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. Signatureljust(width[, fillchar]) Parameters
ReturnIt returns a left justified string. Let's see some examples of ljust() method to understand it's functionalities. Python String ljust() Method Example 1# Python ljust() method example # Variable declaration str = 'TheDeveloperBlog' # Calling function str = str.ljust(20) # Displaying result print(str) Output:
Python String ljust() Method Example 2# Python ljust() method example # Variable declaration str = 'TheDeveloperBlog' # Calling function str = str.ljust(15,"$") # Displaying result print(str) Output:
Next TopicPython Strings
|