I'm a newbie in programming.
I was reading the Python documentation and could not understand the "s[, chars]" in lstrip(s[, chars])
.
I'll appreciate if you can enlighten me.
I'm a newbie in programming.
I was reading the Python documentation and could not understand the "s[, chars]" in lstrip(s[, chars])
.
I'll appreciate if you can enlighten me.
chars
specifies the set of characters that should be stripped from the left end of the string.
The square brackets denote that the argument is optional. If not specified, there is a default set of characters to strip.
Examples:
lstrip(' abc ') == 'abc '
lstrip('12345', '41') == '2345'
lstrip('1112212345111', '12') == '345111'
Note: This function string.lstrip()
only exists in Python 2, not 3.