Introduction to the lstrip () method in Python
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
The lstrip () method returns a duplicate of all characters starting with a removed string (by default, a space character.
Syntax
The following is the syntax of the lstrip () method:
?
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.
?
1 2 3 4 5 6 |
#! /Usr/bin/python Str = "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:
?
1 2 |
This is string example... wow !!! This is string example... wow !!! 8888888 |