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

xml - Extract substrings with XSLT -

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

Fatal error: Call to undefined function menu_execute_active_handler() in drupal 7.9 -