Python lstrip() method
Description
The Python lstrip() method removes leading spaces or specified characters from a string.
Syntax
Syntax of the lstrip() method:
str.lstrip([chars])
Parameters
- chars -- the characters to remove.
Return Value
Returns a new string generated after removing the leading spaces or specified characters.
Example
The following example shows how to use lstrip():
#!/usr/bin/python
str = " this is string example....wow!!! ";
print str.lstrip();
str = "88888888this is string example....wow!!!8888888";
print str.lstrip('8');
The output of the above example is:
this is string example....wow!!!
this is string example....wow!!!8888888
Python Strings