Javatpoint Logo
Javatpoint Logo

Python String lstrip() Method

Python lstrip() method is used to remove all leading characters from the string. It takes a char type parameter which is optional. If parameter is not provided, it removes all the leading spaces from the string.

Signature

Parameters

chars (optional) : A list of chars

Return

It returns a string.

Let's see some examples of lstrip() method to understand it's functionality

Python String lstrip() Method Example 1

A simple program to understand use of lstrip method. See how it removes leading spaces.

Output:

	Javatpoint  
Javatpoint 

Python String lstrip() Method Example 2

Here, we are adding some special chars to the string and applying lstrip to remove leading chars.

Output:

$$$$-Javatpoint-$$$$
-Javatpoint-$$$$

Python String lstrip() Method Example 3

Output:

http://www.javatpoint.com
javatpoint.com

Next TopicPython Strings





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA