Home >>Python String Methods >Python String lstrip() Method
Python string lstrip() method is used to remove any leading characters in the given input string. The default leading character to remove is space.
Syntax:string.lstrip(characters)
Parameter | Description |
---|---|
characters | This is an optional parameter. It defines a set of characters to remove as leading characters. |
txt = " mango "
x = txt.lstrip()
print("of all fruits", x, "is my favorite")
of all fruits mango is my favorite
txt = ",,,,,ssaaww.....Orange"
x = txt.lstrip(",.asw")
print(x)