string - python convention lstrip(s[, chars]). What does "[, chars]" signifies? -


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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -