1、print x._add_( hello)print x._contains_(is a Test | _eq_(self, value, /) | Return self=value. | _format_(.) | S._format_(format_spec) - str | Return a formatted version of S as described by format_spec. | _ge_(self, value, /) | Return self=value. | _getattribute_(self, name, /) | Return getattr(self
2、, name). | _getitem_(self, key, /) | Return selfkey. | _getnewargs_(.) | _gt_(self, value, /)value. | _hash_(self, /) | Return hash(self). | _iter_(self, /) | Implement iter(self). | _le_(self, value, /) | Return self size of S in memory, in bytes | _str_(self, /) | Return str(self). | capitalize(.)
3、 | S.capitalize() - | Return a capitalized version of S, i.e. make the first character | have upper case and the rest lower case. | casefold(.) | S.casefold() - | Return a version of S suitable for caseless comparisons. | center(.) | S.center(width, fillchar) - | Return S centered in a string of len
4、gth width. Padding is | done using the specified fill character (default is a space)print x.center(50,_# *this is a Testing String!* | | count(.) | S.count(sub, start, end) - int | Return the number of non-overlapping occurrences of substring sub in | string Sstart:end. Optional arguments start and
5、end are | interpreted as in slice notation.print x.count( | encode(.) | S.encode(encoding=utf-8, errors=strict) - bytes | Encode S using the codec registered for encoding. Default encoding | is . errors may be given to set a different error | handling scheme. Default is meaning that encoding errors
6、raise | a UnicodeEncodeError. Other possible values are ignore, replace and | xmlcharrefreplace as well as any other name registered with | codecs.register_error that can handle UnicodeEncodeErrors. | endswith(.) | S.endswith(suffix, start, end) - bool | Return True if S ends with the specified suff
7、ix, 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) - | Return a copy of S where all tab characters are expanded using spaces.
8、| If tabsize is not given, a tab size of 8 characters is assumed. | find(.) | S.find(sub, start, end) - | Return the lowest index in S where substring sub is found, | such that sub is contained within Sstart:end. Optional | arguments start and end are interpreted as in slice notation. | Return -1 on
9、 failure. | format(.) | S.format(*args, *kwargs) - | Return a formatted version of S, using substitutions from args and kwargs. | The substitutions are identified by braces ( and ). | format_map(.) | S.format_map(mapping) - | Return a formatted version of S, using substitutions from mapping. | index
10、(.) | S.index(sub, start, end) - | Like S.find() but raise ValueError when the substring is not found. | isalnum(.) | S.isalnum() - | Return True if all characters in S are alphanumeric | and there is at least one character in S, False otherwise. | isalpha(.) | S.isalpha() - | Return True if all cha
11、racters in S are alphabetic | isdecimal(.) | S.isdecimal() - | Return True if there are only decimal characters in S, | False otherwise. | isdigit(.) | S.isdigit() - | Return True if all characters in S are digits | isidentifier(.) | S.isidentifier() - | Return True if S is a valid identifier accord
12、ing | to the language definition. | Use keyword.iskeyword() to test for reserved identifiers | such as def and class.import keywordprint keyword.iskeyword( | islower(.) | S.islower() - | Return True if all cased characters in S are lowercase and there is | at least one cased character in S, False ot
13、herwise. | isnumeric(.) | S.isnumeric() - | Return True if there are only numeric characters in S, print 98673.isalnum()| isprintable(.) | S.isprintable() - | Return True if all characters in S are considered | printable in repr() or S is empty, False otherwise. | isspace(.) | S.isspace() - | Return
14、 True if all characters in S are whitespace | istitle(.) | S.istitle() - | Return True if S is a titlecased string and there is at 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.
15、 | isupper(.) | S.isupper() - | Return True if all cased characters in S are uppercase and there is| join(.) | S.join(iterable) - | Return a string which is the concatenation of the strings in the | iterable. The separator between elements is S. | ljust(.) | S.ljust(width, fillchar) - | Return S lef
16、t-justified in a Unicode string of length width. Padding is | done using the specified fill character (default is a space). | lower(.) | S.lower() - | Return a copy of the string S converted to lowercase. | lstrip(.) | S.lstrip(chars) - | Return a copy of the string S with leading whitespace removed
17、. | If chars is given and not None, remove characters in chars instead. | partition(.) | S.partition(sep) - (head, sep, tail) | Search for the separator sep in S, and return the part before it, | the separator itself, and the part after it. If the separator is not | found, return S and two empty str
18、ings. | replace(.) | S.replace(old, new, count) - | 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.print .replace(86, _RPLS_| rfind(.) | S.rfind(sub, start, end) - | Return the highe
19、st index in S where substring sub is found,print xfor i in xrange(len(x): sys.stdout.write(str(i % 10)printprint x.rfind() ,0,17) | rindex(.) 等同于上面的函数 | S.rindex(sub, start, end) - | Like S.rfind() but raise ValueError when the substring is not found. | rjust(.) | S.rjust(width, fillchar) - | Return
20、 S right-justified in a string of length width. Padding is | rpartition(.) | S.rpartition(sep) - | 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, return two empty strings and
21、S. | rsplit(.) | S.rsplit(sep=None, maxsplit=-1) - list of strings | Return a list of the words in S, using sep as the | delimiter string, starting at the end of the string and | working to the front. If maxsplit is given, at most maxsplit | splits are done. If sep is not specified, any whitespace s
22、tring | is a separator. | rstrip(.) | S.rstrip(chars) - | Return a copy of the string S with trailing whitespace removed. | split(.) | S.split(sep=None, maxsplit=-1) - | delimiter string. If maxsplit is given, at most maxsplit | splits are done. If sep is not specified or is None, any | whitespace s
23、tring is a separator and empty strings are | removed from the result. | splitlines(.) | S.splitlines(keepends) - | Return a list of the lines in S, breaking at line boundaries. | Line breaks are not included in the resulting list unless keepends | is given and true. | startswith(.) | S.startswith(prefix, start, end) -
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1