python help 函数_Python help函数

Help on class str inmodule builtins:class str(object)| str(object='') ->str| str(bytes_or_buffer[, encoding[, errors]]) ->str|

| Create a new string object from the given object. If encoding or| errors is specified, then the objectmust expose a data buffer| that will be decoded usingthe given encoding and error handler.| Otherwise, returns the result of object.__str__() (ifdefined)| or repr(object).|encoding defaults to sys.getdefaultencoding().| errors defaults to 'strict'.|

|Methods defined here:|

| __add__(self, value, /)| Return self+value.|

| __contains__(self, key, /)| Return key inself.|

| __eq__(self, value, /)| Return self==value.|

|__format__(...)| S.__format__(format_spec) ->str|

| Return a formatted version of S asdescribed by format_spec.|

| __ge__(self, value, /)| Return self>=value.|

| __getattribute__(self, name, /)|Return getattr(self, name).|

| __getitem__(self, key, /)|Return self[key].|

|__getnewargs__(...)|

| __gt__(self, value, /)| Return self>value.|

| __hash__(self, /)|Return hash(self).|

| __iter__(self, /)|Implement iter(self).|

| __le__(self, value, /)| Return self<=value.|

| __len__(self, /)|Return len(self).|

| __lt__(self, value, /)| Return self

| __mod__(self, value, /)| Return self%value.|

| __mul__(self, value, /)| Return self*value.n|

| __ne__(self, value, /)| Return self!=value.|

| __new__(*args, **kwargs) frombuiltins.type| Create and return a new object. See help(type) foraccurate signature.|

| __repr__(self, /)|Return repr(self).|

| __rmod__(self, value, /)| Return value%self.|

| __rmul__(self, value, /)| Return self*value.|

|__sizeof__(...)| S.__sizeof__() -> size of S in memory, inbytes|

| __str__(self, /)|Return str(self).|

|capitalize(...)| S.capitalize() ->str|

|Return a capitalized version of S, i.e. make the first character| have upper case and the rest lower case.|

|casefold(...)| S.casefold() ->str|

| Return a version of S suitable forcaseless comparisons.|

|center(...)| S.center(width[, fillchar]) ->str|

| Return S centered in a string of length width. Padding is

| done using the specified fill character (default isa space)|

|count(...)| S.count(sub[, start[, end]]) -> int

|

| Return the number of non-overlapping occurrences of substring sub in

| stringS[start:end]. Optional arguments start and end are| interpreted as inslice notation.|

|encode(...)| S.encode(encoding='utf-8', errors='strict') ->bytes|

| Encode S using the codec registered forencoding. Default encoding| is 'utf-8'. errors may be given to seta different error| handling scheme. Default is 'strict'meaning that encoding errors raise| a UnicodeEncodeError. Other possible values are 'ignore', 'replace'and| 'xmlcharrefreplace' as well asany other name registered with|codecs.register_error that can handle UnicodeEncodeErrors.|

|endswith(...)| S.endswith(suffix[, start[, end]]) -> bool

|

| Return True ifS ends with the specified suffix, False otherwise.|With optional start, test S beginning at that position.|With optional end, stop comparing S at that position.| suffix can also be a tuple of strings to try.|

|expandtabs(...)| S.expandtabs(tabsize=8) ->str|

| Return a copy of S where all tab characters are expanded usingspaces.| If tabsize is not given, a tab size of 8 characters isassumed.|

|find(...)| S.find(sub[, start[, end]]) -> int

|

| Return the lowest index in S where substring sub isfound,| such that sub iscontained within S[start:end]. Optional| arguments start and end are interpreted as inslice notation.|

| Return -1on failure.|

|format(...)| S.format(*args, **kwargs) ->str|

| Return a formatted version of S, using substitutions fromargs and kwargs.| The substitutions are identified by braces ('{' and '}').|

|format_map(...)| S.format_map(mapping) ->str|

| Return a formatted version of S, using substitutions frommapping.| The substitutions are identified by braces ('{' and '}').|

|index(...)| S.index(sub[, start[, end]]) -> int

|

| Return the lowest index in S where substring sub isfound,| such that sub iscontained within S[start:end]. Optional| arguments start and end are interpreted as inslice notation.|

| Raises ValueError when the substring isnot found.|

|isalnum(...)| S.isalnum() -> bool

|

| Return True if all characters inS are alphanumeric| and there is at least one character inS, False otherwise.|

|isalpha(...)| S.isalpha() -> bool

|

| Return True if all characters inS are alphabetic| and there is at least one character inS, False otherwise.|

|isdecimal(...)| S.isdecimal() -> bool

|

| Return True if there are only decimal characters inS,|False otherwise.|

|isdigit(...)| S.isdigit() -> bool

|

| Return True if all characters inS are digits| and there is at least one character inS, False otherwise.|

|isidentifier(...)| S.isidentifier() -> bool

|

| Return True if S isa valid identifier according|to the language definition.|

| Use keyword.iskeyword() to test forreserved identifiers| such as "def" and "class".|

|islower(...)| S.islower() -> bool

|

| Return True if all cased characters in S are lowercase and there is

| at least one cased character inS, False otherwise.|

|isnumeric(...)| S.isnumeric() -> bool

|

| Return True if there are only numeric characters inS,|False otherwise.|

|isprintable(...)| S.isprintable() -> bool

|

| Return True if all characters inS are considered| printable in repr() or S isempty, False otherwise.|

|isspace(...)| S.isspace() -> bool

|

| Return True if all characters inS are whitespace| and there is at least one character inS, False otherwise.|

|istitle(...)| S.istitle() -> bool

|

| Return True if S is a titlecased string and there isat least one| character in S, i.e. upper-and titlecase characters may only|follow uncased characters and lowercase characters only cased ones.|Return False otherwise.|

|isupper(...)| S.isupper() -> bool

|

| Return True if all cased characters in S are uppercase and there is

| at least one cased character inS, False otherwise.|

|join(...)| S.join(iterable) ->str|

| Return a string which is the concatenation of the strings inthe| iterable. The separator between elements isS.|

|ljust(...)| S.ljust(width[, fillchar]) ->str|

| Return S left-justified in a Unicode string of length width. Padding is

| done using the specified fill character (default isa space).|

|lower(...)| S.lower() ->str|

| Return a copy of the stringS converted to lowercase.|

|lstrip(...)| S.lstrip([chars]) ->str|

| Return a copy of the stringS with leading whitespace removed.| If chars is given and not None, remove characters inchars instead.|

|partition(...)| S.partition(sep) ->(head, sep, tail)|

| Search for the separator sep in S, and returnthe part before it,| the separator itself, and the part after it. If the separator isnot| found, returnS and two empty strings.|

|replace(...)| S.replace(old, new[, count]) ->str|

|Return a copy of S with all occurrences of substring| old replaced by new. If the optional argument count is

|given, only the first count occurrences are replaced.|

|rfind(...)| S.rfind(sub[, start[, end]]) -> int

|

| Return the highest index in S where substring sub isfound,| such that sub iscontained within S[start:end]. Optional| arguments start and end are interpreted as inslice notation.|

| Return -1on failure.|

|rindex(...)| S.rindex(sub[, start[, end]]) -> int

|

| Return the highest index in S where substring sub isfound,| such that sub iscontained within S[start:end]. Optional| arguments start and end are interpreted as inslice notation.|

| Raises ValueError when the substring isnot found.|

|rjust(...)| S.rjust(width[, fillchar]) ->str|

| Return S right-justified in a string of length width. Padding is

| done using the specified fill character (default isa space).|

|rpartition(...)| S.rpartition(sep) ->(head, sep, tail)|

| Search for the separator sep in S, starting at the end of S, and return

|the part before it, the separator itself, and the part after it. If the| separator is not found, returntwo empty strings and S.|

|rsplit(...)| S.rsplit(sep=None, maxsplit=-1) ->list of strings|

| Return a list of the words in S, using sep asthe| delimiter string, starting at the end of the stringand| working to the front. If maxsplit isgiven, at most maxsplit| splits are done. If sep is not specified, any whitespace string

| isa separator.|

|rstrip(...)| S.rstrip([chars]) ->str|

| Return a copy of the stringS with trailing whitespace removed.| If chars is given and not None, remove characters inchars instead.|

|split(...)| S.split(sep=None, maxsplit=-1) ->list of strings|

| Return a list of the words in S, using sep asthe| delimiter string. If maxsplit isgiven, at most maxsplit| splits are done. If sep is not specified or isNone, any| whitespace string isa separator and empty strings are| removed fromthe result.|

|splitlines(...)| S.splitlines([keepends]) ->list of strings|

| Return a list of the lines inS, breaking at line boundaries.| Line breaks are not included inthe resulting list unless keepends| is given and true.|

|startswith(...)| S.startswith(prefix[, start[, end]]) -> bool

|

| Return True ifS starts with the specified prefix, False otherwise.|With optional start, test S beginning at that position.|With optional end, stop comparing S at that position.| prefix can also be a tuple of strings to try.|

|strip(...)| S.strip([chars]) ->str|

| Return a copy of the stringS with leading and trailing|whitespace removed.| If chars is given and not None, remove characters inchars instead.|

|swapcase(...)| S.swapcase() ->str|

|Return a copy of S with uppercase characters converted to lowercase|and vice versa.|

|title(...)| S.title() ->str|

| Return a titlecased version of S, i.e. words start with title case

| characters, all remaining cased characters have lower case.|

|translate(...)| S.translate(table) ->str|

| Return a copy of the string S inwhich each character has been mapped|through the given translation table. The table must implement| lookup/indexing via __getitem__, forinstance a dictionary or list,|mapping Unicode ordinals to Unicode ordinals, strings, or None. If| this operation raises LookupError, the character isleft untouched.|Characters mapped to None are deleted.|

|upper(...)| S.upper() ->str|

|Return a copy of S converted to uppercase.|

|zfill(...)| S.zfill(width) ->str|

| Pad a numeric stringS with zeros on the left, to fill a field| of the specified width. The string S isnever truncated.|

| ----------------------------------------------------------------------

|Static methods defined here:|

| maketrans(x, y=None, z=None, /)| Return a translation table usable forstr.translate().|

| If there isonly one argument, it must be a dictionary mapping Unicode|ordinals (integers) or characters to Unicode ordinals, strings or None.|Character keys will be then converted to ordinals.|If there are two arguments, they must be strings of equal length, and| in the resulting dictionary, each character inx will be mapped to the| character at the same position in y. If there isa third argument, it| must be a string, whose characters will be mapped to None inthe result.

None-10Process finished with exit code0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值