lstrip() function in python by R4R Team

- lstrip() is a python in-build function which are used to delete the specified content at the left side of the string
- it take one string as an argument which we want to remove from the left portion of the given string.

Syntax-

str.lstrip(chars)

Example

string is s="this is string"
and s.lstrip("this") will return "is string"



program-

s="This is string"
print(s.lstrip('This'))
s="11111111111mgs"
print(s.lstrip('1'))
s="-----this is string-------"
print(s.lstrip("-"))
s="-----this is string-------"
print(s.lstrip("this"))


output-

is string
mgs
this is string-------
-----this is string-------


-In this program, we operate lstrip() function on different strings in the above program and remove the left side of string and print them.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!