This article mainly introduces the Lstrip () method in Python using the introduction, is the basics of Python primer, need friends can refer to the
The Lstrip () method returns a copy of all characters that have been stripped of the opening string (the default is a space character).
Grammar
The following is the syntax for the Lstrip () method:
?
Parameters
Chars--You provide the characters you want to trim.
return value
This method returns a copy of the string where all characters are removed from the beginning of the string (the default is a space character).
Example
The following example shows the use of the Lstrip () method.
?
1 2 3 4 5 6 |
#!/usr/bin/python str = "This is string Example....wow!!!"; Print Str.lstrip (); str = "88888888this is string EXAMPLE....WOW!!! 8888888 "; Print Str.lstrip (' 8 '); |
When we run the above program, it produces the following results:
?
1 2 |
This is string EXAMPLE....WOW!!! This is string EXAMPLE....WOW!!! 8888888 |