Definition
The lstrip() method removes any leading characters (space is the default leading character to remove)
Syntax
string.lstrip(chars)
Parameters
Parameter | Description |
---|---|
chars | Optional. A set of characters to remove as leading characters |
Examples:
testStr = " Python "
result = testStr.lstrip()
print(result, " is also a snake.")
# another example
testStr = ",,,,,ssaaww.....Python"
result = testStr.lstrip(",.asw")
print(result)