![]() |
VOOZH | about |
The lstrip() method removes leading whitespace characters from a string. We can also specify custom characters to remove from the beginning/starting of the string.
Let's take an example to remove whitespace from the starting of a string.
Hello Python!
s.lstrip(chars)
Table of Content
Hello Python!
If we have a string with various characters that we want to remove from starting of the string then we can use lstrip().
Hello Python!#**##
Notes:
We can also remove the leading newline characters (\n) from a string.
Hello Python!