How to read Python Documentation -
i'm trying understand how should read python documentation, example given:
string.lstrip(s[, chars])
how should read that? know brackets means optional, 's', mean? there page explains how documentation written?
it's not explictly defined in documentation, in
string.lstrip(s[, chars])
string
python module, not string (e.g. can't "abc"
).
the parameter s
string (e.g. can "abc"
) want strip. it's mandatory, not optional.
the bracket-enclosed parameter optional, string , characters stripped string.
some examples of how call function are:
import string print string.lstrip("abc", "a") # "bc" print string.lstrip(" abc") # "abc"
note: don't confuse "abc".lstrip()
. different functions identical results. also, read @user2357112's comment.
edit: on ide i've tested , shows s
on docs (pressing f2):
def lstrip found at: string def lstrip(s, chars=none): """lstrip(s [,chars]) -> string return copy of string s leading whitespace removed. if chars given , not none, remove characters in chars instead. """ return s.lstrip(chars) # strip trailing tabs , spaces
Comments
Post a Comment