1、0001aboutSTR- - - - 延时输出内容# coding:utf-8import sysimport timeout = sys.stdout.writedef pr(aString): for i in aString: out(i) time.sleep(0.01)str文档 help(str)Help on class str in module builtins:class str(object)| Methods defined here: | | _add_(self, value, /) | Return self+value.| _contains_(self, k
2、ey, /) | Return key in self.x = this is a Testing String!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 s
3、elf=value. | | _getattribute_(self, name, /) | Return getattr(self, name). | | _getitem_(self, key, /) | Return selfkey. | | _getnewargs_(.) | | _gt_(self, value, /) | Return selfvalue. | | _hash_(self, /) | Return hash(self). | | _iter_(self, /) | Implement iter(self). | | _le_(self, value, /) | Re
4、turn self=value. | | _len_(self, /) | Return len(self). | | _lt_(self, value, /) | Return self size of S in memory, in bytes | | _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
5、rest lower case. | | casefold(.) | S.casefold() - str | | Return a version of S suitable for caseless 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 is a space)print x.cente
6、r(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 end are | interpreted as in slice notation.print x.count( ) | encode(.) | S.encode(encoding=ut
7、f-8, errors=strict) - bytes | | Encode S using the codec registered for encoding. Default encoding | is utf-8. errors may be given to set a different error | handling scheme. Default is strict meaning that encoding errors raise | a UnicodeEncodeError. Other possible values are ignore, replace and |
8、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 suffix, False otherwise. | With optional start, test S beginning at that posit
9、ion. | 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 using spaces. | If tabsize is not given, a tab size of 8 characters is assumed.
10、| | find(.) | S.find(sub, start, end) - int | | 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 failure. | | format(.) | S.format(*args, *kwargs) - str
11、 | | 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) - str | | Return a formatted version of S, using substitutions from mapping. | The substitutions are identified by braces (
12、and ). | | index(.) | S.index(sub, start, end) - int | | Like S.find() but raise ValueError when the substring is not found. | | isalnum(.) | S.isalnum() - bool | | Return True if all characters in S are alphanumeric | and there is at least one character in S, False otherwise. | | isalpha(.) | S.isa
13、lpha() - bool | | Return True if all characters in S are alphabetic | and there is at least one character in S, False otherwise. | | isdecimal(.) | S.isdecimal() - bool | | Return True if there are only decimal characters in S, | False otherwise. | | isdigit(.) | S.isdigit() - bool | | Return True i
14、f all characters in S are digits | and there is at least one character in S, False otherwise. | | isidentifier(.) | S.isidentifier() - bool | | Return True if S is a valid identifier according | to the language definition. | | Use keyword.iskeyword() to test for reserved identifiers | such as def an
15、d class.import keywordprint keyword.iskeyword(def) | | islower(.) | S.islower() - bool | | Return True if all cased characters in S are lowercase and there is | at least one cased character in S, False otherwise. | | isnumeric(.) | S.isnumeric() - bool | | Return True if there are only numeric chara
16、cters in S, | False otherwise. print 98673.isalnum() | isprintable(.) | S.isprintable() - bool | | Return True if all characters in S are considered | printable in repr() or S is empty, False otherwise. | | isspace(.) | S.isspace() - bool | | Return True if all characters in S are whitespace | and t
17、here is at least one character in S, False otherwise. | | istitle(.) | S.istitle() - bool | | 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. | Retu
18、rn False otherwise. | | isupper(.) | S.isupper() - bool | | Return True if all cased characters in S are uppercase and there is | at least one cased character in S, False otherwise. | join(.) | S.join(iterable) - str | | Return a string which is the concatenation of the strings in the | iterable. Th
19、e separator between elements is S. | | 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 is a space). | | lower(.) | S.lower() - str | | Return a copy of the string S converted to l
20、owercase. | | lstrip(.) | S.lstrip(chars) - str | | Return a copy of the string S with leading whitespace removed. | 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
21、before it, | the separator itself, and the part after it. If the separator is not | found, return S 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
22、 the first count occurrences are replaced.print 98673.replace(86, _RPLS_) | rfind(.) | S.rfind(sub, start, end) - int | | Return the highest 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 notatio
23、n. | | Return -1 on failure. | import sysx = this is a Testing String!print xfor i in xrange(len(x): sys.stdout.write(str(i % 10)printprint x.rfind( ) print x.rfind( ,0,17) | rindex(.) 等同于上面的函数 | S.rindex(sub, start, end) - int | | Like S.rfind() but raise ValueError when the substring is not found.
24、 | | 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 is a space). | | rpartition(.) | S.rpartition(sep) - (head, sep, tail) | | Search for the separator sep in S, starting at the end of
25、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 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 th
26、e 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 string | is a separator. | | rstrip(.) | S.rstrip(chars) - str | | Return a copy of the string S with trailing whitespace removed. | If chars is given and
27、 not None, remove characters in chars instead. | | split(.) | S.split(sep=None, maxsplit=-1) - list of strings | | Return a list of the words in S, using sep as the | delimiter string. If maxsplit is given, at most maxsplit | splits are done. If sep is not specified or is None, any | whitespace stri
28、ng is a separator and empty strings are | removed from the result. | | splitlines(.) | S.splitlines(keepends) - list of strings | | 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) - bool |
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1