string - python convention lstrip(s[, chars]). What does "[, chars]" signifies? -
this question has answer here:
i'm newbie in programming. reading python documentation , not understand "s[, chars]" in lstrip(s[, chars])
.
i'll appreciate if can enlighten me.
chars
specifies set of characters should stripped left end of string.
the square brackets denote argument optional. if not specified, there default set of characters strip.
examples:
lstrip(' abc ') == 'abc '
lstrip('12345', '41') == '2345'
lstrip('1112212345111', '12') == '345111'
note: function string.lstrip()
exists in python 2, not 3.
Comments
Post a Comment