This article describes how to use the lstrip () method in Python. it is the basic knowledge for getting started with Python. For more information, see lstrip () returns a duplicate of all characters starting with the removed string (space character by default.
Syntax
The following is the syntax of the lstrip () method:
Str. lstrip ([chars])
Parameters
- Chars -- the character you want to crop.
Return value
This method returns a duplicate of all characters starting with the removed string (default: space.
Example
The following example shows how to use the lstrip () method.
#! /Usr/bin/pythonstr = "this is string example... wow !!! "; Print str. lstrip (); str =" 88888888 this is string example... wow !!! 8888888 "; print str. lstrip ('8 ');
When we run the above program, it will produce the following results:
This is string example... wow !!! This is string example... wow !!! 8888888