一.基本数据类型
整数:int
字符串:str(注:\t等于一个tab键)
布尔值: bool
列表:list
列表用[]
元祖:tuple
元祖用()
字典:dict
注:所有的数据类型都存在想对应的类列里
二.字符串所有数据类型:
基本操作:
索引,切片,追加,删除,长度,切片,循环,包含
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 object must expose a data buffer
that will be decoded using the given encoding and error handler.
otherwise, returns the result of object.__str__() (if defined)
or repr(object).
encoding defaults to sys.getdefaultencoding().
errors defaults to ‘strict’.
“””
def capitalize(self): # real signature unknown; restored from __doc__
“””
s.capitalize() -> str
return a capitalized version of s, i.e. make the first character
have upper case and the rest lower case.(返回一个大写版本的年代,即第一个字符,有大写,其余小写。)
“””
return “”
def casefold(self): # real signature unknown; restored from __doc__
“””
s.casefold() -> str
return a version of s suitable for caseless comparisons.(返回一个版本的s适合caseless比较。)
“””
return “”
def center(self, width, fillchar=none): # real signature unknown; restored from __doc__
“””
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)(返回年代集中在一个字符串的长度宽度。填充使用指定的填充字符(默认是一个空间))
“””
return “”
def count(self, sub, start=none, end=none): # real signature unknown; restored from __doc__
“””
s.count(sub[, start[, end]]) -> int
return the number of non-overlapping occurrences of substring sub in
string s[start:end]. optional arguments start and end are
interpreted as in slice notation.
(返回的数量重叠出现的子串子字符串(开始:结束)。可选参数的开始和结束解释为片符号。)
“””
return 0
def encode(self, encoding=’utf-8′, errors=’strict’): # real signature unknown; restored from __doc__
“””
s.encode(encoding=’utf-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
‘xmlcharrefreplace’ as well as any other name registered with
codecs.register_error that can handle unicodeencodeerrors.
“””
return b””
def expandtabs(self, tabsize=8): # real signature unknown; restored from __doc__
“””
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.
(返回一个副本的年代,所有制表符使用空间扩大。如果tabsize不是,一个标签大小8个字符。)
“””
return “”
def find(self, sub, start=none, end=none): # real signature unknown; restored from __doc__
“””
s.find(sub[, start[, end]]) -> int
return the lowest index in s where substring sub is found,
such that sub is contained within s[start:end]. optional
arguments start and end are interpreted as in slice notation.
return -1 on failure.
(回报指数最低的年代找到子字符串的子,这样的子是包含在s[开始:结束]。可选参数中解释为开始和结束符号。)
“””
return 0
def format(self, *args, **kwargs): # known special case of str.format
“””
s.format(*args, **kwargs) -> str
return a formatted version of s, using substitutions from args and kwargs.
the substitutions are identified by braces (‘{‘ and ‘}’).
(返回一个格式化的年代,利用参数的替换和kwargs。替换被括号(“{”和“}”)。)
“””
pass
def format_map(self, mapping): # real signature unknown; restored from __doc__
“””
s.format_map(mapping) -> str
return a formatted version of s, using substitutions from mapping.
the substitutions are identified by braces (‘{‘ and ‘}’).
(返回一个格式化的年代,利用映射的替换。替换被括号(“{”和“}”)。)
“””
return “”
def index(self, sub, start=none, end=none): # real signature unknown; restored from __doc__
“””
s.index(sub[, start[, end]]) -> int
like s.find() but raise valueerror when the substring is not found.
(像s.find(),但没有找到子字符串时提高valueerror)
“””
return 0
def isalnum(self): # real signature unknown; restored from __doc__
“””
s.isalnum() -> bool
return true if all characters in s are alphanumeric
and there is at least one character in s, false otherwise.
(如果在年代所有的人物都是字母数字返回true和至少有一个角色年代,否则假。)
“””
return false
def isalpha(self): # real signature unknown; restored from __doc__
“””
s.isalpha() -> bool
return true if all characters in s are alphabetic
and there is at least one character in s, false otherwise.
(如果在年代所有的人物都是字母返回true和至少有一个角色年代,否则假。)
“””
return false
def isdigit(self): # real signature unknown; restored from __doc__
“””
s.isdigit() -> bool
return true if all characters in s are digits
and there is at least one character in s, false otherwise.
(返回true,如果在年代所有的人物都是数字和至少有一个角色年代,否则假。)
“””
return false
def islower(self): # real signature unknown; restored from __doc__
“””
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.
(返回true,如果所有s是小写,下套管的字符至少有一个下套管在年代,否则假。)
“””
return false
def isnumeric(self): # real signature unknown; restored from __doc__
“””
s.isnumeric() -> bool
return true if there are only numeric characters in s,
false otherwise.
(返回true,如果只有数字字符,否则错误。)
“””
return false
def isprintable(self): # real signature unknown; restored from __doc__
“””
s.isprintable() -> bool
return true if all characters in s are considered
printable in repr() or s is empty, false otherwise.
(如果在年代所有的人物都是考虑返回true,可打印在repr()或年代是空的,否则假。)
“””
return false
def isspace(self): # real signature unknown; restored from __doc__
“””
s.isspace() -> bool
return true if all characters in s are whitespace
and there is at least one character in s, false otherwise.
(返回true,如果在年代所有的人物都是空白和至少有一个角色年代,否则假。)
“””
return false
def istitle(self): # real signature unknown; restored from __doc__
“””
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.
return false otherwise.
(返回true,如果s titlecased字符串和至少有一个个性的年代,即上,可能只titlecase字符遵循外露的字符和小写字符只下套管。否则返回假。)
“””
return false
def isupper(self): # real signature unknown; restored from __doc__
“””
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.
(返回true,如果所有s是大写,下套管的字符至少有一个下套管在年代,否则假。)
“””
return false
def join(self, iterable): # real signature unknown; restored from __doc__
“””
s.join(iterable) -> str
return a string which is the concatenation of the strings in the
iterable. the separator between elements is s.
(返回一个字符串的连接字符串iterable。元素之间的分隔符是s。)
“””
return “”
def ljust(self, width, fillchar=none): # real signature unknown; restored from __doc__
“””
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).
(返回年代左对齐的unicode字符串的长度宽度。填充使用指定的填充字符(默认值是一个空格)。)
“””
return “”
def lower(self): # real signature unknown; restored from __doc__
“””
s.lower() -> str
return a copy of the string s converted to lowercase.
(返回的字符串转换为小写。)
“””
return “”
def lstrip(self, chars=none): # real signature unknown; restored from __doc__
“””
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.
(返回字符串的副本删除前导空白。如果字符而不是没有,删除字符字符代替。)
“””
return “”
def partition(self, sep): # real signature unknown; restored from __doc__
“””
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 strings.
(搜索分离器sep的年代,并返回之前的部分一样,分隔符本身,后一部分。如果分隔符发现,还和两个空字符串。)
“””
pass
def replace(self, old, new, count=none): # real signature unknown; restored from __doc__
“””
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.
(返回一个年代出现的所有子字符串的副本老被新的取代。如果可选参数计数,只替换第一计数。)
“””
return “”
def rfind(self, sub, start=none, end=none): # real signature unknown; restored from __doc__
“””
s.rfind(sub[, start[, end]]) -> int
return the highest index in s where substring sub is found,
such that sub is contained within s[start:end]. optional
arguments start and end are interpreted as in slice notation.
return -1 on failure.
(回报最高的指数在年代找到子字符串的子,这样的子是包含在s[开始:结束]。可选参数中解释为开始和结束符号。)
“””
return 0
def rindex(self, sub, start=none, end=none): # real signature unknown; restored from __doc__
“””
s.rindex(sub[, start[, end]]) -> int
like s.rfind() but raise valueerror when the substring is not found.
(像s.rfind(),但没有找到子字符串时提高valueerror。)
“””
return 0
def rjust(self, width, fillchar=none): # real signature unknown; restored from __doc__
“””
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).
(返回右对齐的在一个字符串的长度宽度。填充使用指定的填充字符(默认值是一个空格))
“””
return “”
def rpartition(self, sep): # real signature unknown; restored from __doc__
“””
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, return two empty strings and s.
(寻找分离器在年代,9月开始的年代,并返回之前的部分一样,分离器本身,后一部分。如果没有找到分隔符,返回两个空字符串和年代。)
“””
pass
def rsplit(self, sep=none, maxsplit=-1): # real signature unknown; restored from __doc__
“””
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 string
is a separator.
(返回一个列表的单词,使用9月作为分隔符字符串,字符串的结束和开始工作到前面来。如果maxsplit,最多maxsplit分割完成。如果没有指定9月,任何空白字符串是一个分隔符。)
“””
return []
def rstrip(self, chars=none): # real signature unknown; restored from __doc__
“””
s.rstrip([chars]) -> str
return a copy of the string s with trailing whitespace removed.
if chars is given and not none, remove characters in chars instead.
(返回一个字符串的副本年代尾随空格移除。如果字符而不是没有,删除字符字符代替。)
“””
return “”
def split(self, sep=none, maxsplit=-1): # real signature unknown; restored from __doc__
“””
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 string is a separator and empty strings are
removed from the result.
(返回一个列表的单词,使用9月作为
分隔符的字符串。如果maxsplit,最多maxsplit
分割完成。如果没有指定9月或没有,
空白字符串分隔符和空字符串
从结果中删除。)
“””
return []
def splitlines(self, keepends=none): # real signature unknown; restored from __doc__
“””
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.(返回一个列表的行,行打破界限。换行符不包括在结果列表,除非keepends和真正的。)
“””
return []
def startswith(self, prefix, start=none, end=none): # real signature unknown; restored from __doc__
“””
s.startswith(prefix[, start[, end]]) -> bool
return true if s 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.
(返回true,如果年代始于指定的前缀,否则假。
可选的开始,测试年代开始在那个位置。
带有可选结束,停止比较年代在那个位置。
前缀也可以尝试一个元组的字符串。)
“””
return false
def strip(self, chars=none): # real signature unknown; restored from __doc__
“””
s.strip([chars]) -> str
return a copy of the string s with leading and trailing
whitespace removed.
if chars is given and not none, remove characters in chars instead.(返回字符串的副本与前导和尾随空格移除。如果字符而不是没有,删除字符字符代替。)
“””
return “”
def swapcase(self): # real signature unknown; restored from __doc__
“””
s.swapcase() -> str
return a copy of s with uppercase characters converted to lowercase
and vice versa.(返回一个副本的年代大写字符转换为小写反之亦然)
“””
return “”
def title(self): # real signature unknown; restored from __doc__
“””
s.title() -> str
return a titlecased version of s, i.e. words start with title case
characters, all remaining cased characters have lower case.(返回一个titlecased版本的年代,即单词从标题开始字符,所有剩余的下套管字符小写)
“””
return “”
def translate(self, table): # real signature unknown; restored from __doc__
“””
s.translate(table) -> str
return a copy of the string s in which each character has been mapped
through the given translation table. the table must implement
lookup/indexing via __getitem__, for instance a dictionary or list,
mapping unicode ordinals to unicode ordinals, strings, or none. if
this operation raises lookuperror, the character is left untouched.
characters mapped to none are deleted.(返回的字符串的每个字符被映射通过给定的转换表。
表必须实现通过__getitem__查找/索引,例如字典或列表,unicode依次映射到unicode序数、字符串或没有。
如果此操作提出了lookuperror,字符保持不变)
“””
return “”
def upper(self): # real signature unknown; restored from __doc__
“””
s.upper() -> str
return a copy of s converted to uppercase.(返回一个副本年代转换为大写)
“””
return “”
def zfill(self, width): # real signature unknown; restored from __doc__
“””
s.zfill(width) -> str
pad a numeric string s with zeros on the left, to fill a field
of the specified width. the string s is never truncated.(垫一个数字字符串与0年代在左边,填补一个字段指定的宽度。字符串年代不会截断。)
“””
return “”
def __add__(self, *args, **kwargs): # real signature unknown
“”” return self+value. “””
pass
def __contains__(self, *args, **kwargs): # real signature unknown
“”” return key in self. “””
pass
def __eq__(self, *args, **kwargs): # real signature unknown
“”” return self==value. “””
pass
def __format__(self, format_spec): # real signature unknown; restored from __doc__
“””
s.__format__(format_spec) -> str
return a formatted version of s as described by format_spec.
“””
return “”
def __getattribute__(self, *args, **kwargs): # real signature unknown
“”” return getattr(self, name). “””
pass
def __getitem__(self, *args, **kwargs): # real signature unknown
“”” return self[key]. “””
pass
def __getnewargs__(self, *args, **kwargs): # real signature unknown
pass
def __ge__(self, *args, **kwargs): # real signature unknown
“”” return self>=value. “””
pass
def __gt__(self, *args, **kwargs): # real signature unknown
“”” return self>value. “””
pass
def __hash__(self, *args, **kwargs): # real signature unknown
“”” return hash(self). “””
pass
def __init__(self, value=”, encoding=none, errors=’strict’): # known special case of str.__init__
“””
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 object must expose a data buffer
that will be decoded using the given encoding and error handler.
otherwise, returns the result of object.__str__() (if defined)
or repr(object).
encoding defaults to sys.getdefaultencoding().
errors defaults to ‘strict’.
# (copied from class doc)
“””
pass
def __iter__(self, *args, **kwargs): # real signature unknown
“”” implement iter(self). “””
pass
def __len__(self, *args, **kwargs): # real signature unknown
“”” return len(self). “””
pass
def __le__(self, *args, **kwargs): # real signature unknown
“”” return self same as super(__class__, )
super(type) -> unbound super object
super(type, obj) -> bound super object; requires isinstance(obj, type)
super(type, type2) -> bound super object; requires issubclass(type2, type)
typical use to call a cooperative superclass method:
class c(b):
def meth(self, arg):
super().meth(arg)
this works for class methods too:
class c(b):
@classmethod
def cmeth(cls, arg):
super().cmeth(arg)
“””
def __getattribute__(self, *args, **kwargs): # real signature unknown
“”” return getattr(self, name). “””
pass
def __get__(self, *args, **kwargs): # real signature unknown
“”” return an attribute of instance, which is of type owner. “””
pass
def __init__(self, type1=none, type2=none): # known special case of super.__init__
“””
super() -> same as super(__class__, )
super(type) -> unbound super object
super(type, obj) -> bound super object; requires isinstance(obj, type)
super(type, type2) -> bound super object; requires issubclass(type2, type)
typical use to call a cooperative superclass method:
class c(b):
def meth(self, arg):
super().meth(arg)
this works for class methods too:
class c(b):
@classmethod
def cmeth(cls, arg):
super().cmeth(arg)
# (copied from class doc)
“””
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
def __repr__(self, *args, **kwargs): # real signature unknown
“”” return repr(self). “””
pass
__self_class__ = property(lambda self: type(object))
“””the type of the instance invoking super(); may be none
:type: type
“””
__self__ = property(lambda self: type(object))
“””the instance invoking super(); may be none
:type: type
“””
__thisclass__ = property(lambda self: type(object))
“””the class invoking super()
:type: type
“””
class syntaxwarning(warning):
“”” base class for warnings about dubious syntax. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class systemerror(exception):
“””
internal error in the python interpreter.
please report this to the python maintainer, along with the traceback,
the python version, and the hardware/os platform and version.
“””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class systemexit(baseexception):
“”” request to exit from the interpreter. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
code = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception code”””
class taberror(indentationerror):
“”” improper mixture of spaces and tabs. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
class timeouterror(oserror):
“”” timeout expired. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
class tuple(object):
“””
tuple() -> empty tuple
tuple(iterable) -> tuple initialized from iterable’s items
if the argument is a tuple, the return value is the same object.
“””
def count(self, value): # real signature unknown; restored from __doc__
“”” t.count(value) -> integer — return number of occurrences of value “””
return 0
def index(self, value, start=none, stop=none): # real signature unknown; restored from __doc__
“””
t.index(value, [start, [stop]]) -> integer — return first index of value.
raises valueerror if the value is not present.
“””
return 0
def __add__(self, *args, **kwargs): # real signature unknown
“”” return self+value. “””
pass
def __contains__(self, *args, **kwargs): # real signature unknown
“”” return key in self. “””
pass
def __eq__(self, *args, **kwargs): # real signature unknown
“”” return self==value. “””
pass
def __getattribute__(self, *args, **kwargs): # real signature unknown
“”” return getattr(self, name). “””
pass
def __getitem__(self, *args, **kwargs): # real signature unknown
“”” return self[key]. “””
pass
def __getnewargs__(self, *args, **kwargs): # real signature unknown
pass
def __ge__(self, *args, **kwargs): # real signature unknown
“”” return self>=value. “””
pass
def __gt__(self, *args, **kwargs): # real signature unknown
“”” return self>value. “””
pass
def __hash__(self, *args, **kwargs): # real signature unknown
“”” return hash(self). “””
pass
def __init__(self, seq=()): # known special case of tuple.__init__
“””
tuple() -> empty tuple
tuple(iterable) -> tuple initialized from iterable’s items
if the argument is a tuple, the return value is the same object.
# (copied from class doc)
“””
pass
def __iter__(self, *args, **kwargs): # real signature unknown
“”” implement iter(self). “””
pass
def __len__(self, *args, **kwargs): # real signature unknown
“”” return len(self). “””
pass
def __le__(self, *args, **kwargs): # real signature unknown
“”” return self list
specialized __dir__ implementation for types
“””
return []
def __getattribute__(self, *args, **kwargs): # real signature unknown
“”” return getattr(self, name). “””
pass
def __init__(cls, what, bases=none, dict=none): # known special case of type.__init__
“””
type(object_or_name, bases, dict)
type(object) -> the object’s type
type(name, bases, dict) -> a new type
# (copied from class doc)
“””
pass
def __instancecheck__(self): # real signature unknown; restored from __doc__
“””
__instancecheck__() -> bool
check if an object is an instance
“””
return false
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
def __prepare__(self): # real signature unknown; restored from __doc__
“””
__prepare__() -> dict
used to create the namespace for the class statement
“””
return {}
def __repr__(self, *args, **kwargs): # real signature unknown
“”” return repr(self). “””
pass
def __setattr__(self, *args, **kwargs): # real signature unknown
“”” implement setattr(self, name, value). “””
pass
def __sizeof__(self): # real signature unknown; restored from __doc__
“””
__sizeof__() -> int
return memory consumption of the type object
“””
return 0
def __subclasscheck__(self): # real signature unknown; restored from __doc__
“””
__subclasscheck__() -> bool
check if a class is a subclass
“””
return false
def __subclasses__(self): # real signature unknown; restored from __doc__
“”” __subclasses__() -> list of immediate subclasses “””
return []
__abstractmethods__ = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
__bases__ = (
object,
)
__base__ = object
__basicsize__ = 864
__dictoffset__ = 264
__dict__ = none # (!) real value is ”
__flags__ = -2146675712
__itemsize__ = 40
__mro__ = (
none, # (!) forward: type, real value is ”
object,
)
__name__ = ‘type’
__qualname__ = ‘type’
__text_signature__ = none
__weakrefoffset__ = 368
class typeerror(exception):
“”” inappropriate argument type. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class unboundlocalerror(nameerror):
“”” local name referenced but not bound to a value. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class valueerror(exception):
“”” inappropriate argument value (of correct type). “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class unicodeerror(valueerror):
“”” unicode related error. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class unicodedecodeerror(unicodeerror):
“”” unicode decoding error. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
def __str__(self, *args, **kwargs): # real signature unknown
“”” return str(self). “””
pass
encoding = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception encoding”””
end = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception end”””
object = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception object”””
reason = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception reason”””
start = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception start”””
class unicodeencodeerror(unicodeerror):
“”” unicode encoding error. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
def __str__(self, *args, **kwargs): # real signature unknown
“”” return str(self). “””
pass
encoding = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception encoding”””
end = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception end”””
object = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception object”””
reason = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception reason”””
start = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception start”””
class unicodetranslateerror(unicodeerror):
“”” unicode translation error. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
def __str__(self, *args, **kwargs): # real signature unknown
“”” return str(self). “””
pass
encoding = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception encoding”””
end = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception end”””
object = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception object”””
reason = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception reason”””
start = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””exception start”””
class unicodewarning(warning):
“””
base class for warnings about unicode related problems, mostly
related to conversion problems.
“””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class userwarning(warning):
“”” base class for warnings generated by user code. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class zeropisionerror(arithmeticerror):
“”” second argument to a pision or modulo operation was zero. “””
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
class zip(object):
“””
zip(iter1 [,iter2 […]]) –> zip object
return a zip object whose .__next__() method returns a tuple where
the i-th element comes from the i-th iterable argument. the .__next__()
method continues until the shortest iterable in the argument sequence
is exhausted and then it raises stopiteration.
“””
def __getattribute__(self, *args, **kwargs): # real signature unknown
“”” return getattr(self, name). “””
pass
def __init__(self, iter1, iter2=none, *some): # real signature unknown; restored from __doc__
pass
def __iter__(self, *args, **kwargs): # real signature unknown
“”” implement iter(self). “””
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
“”” create and return a new object. see help(type) for accurate signature. “””
pass
def __next__(self, *args, **kwargs): # real signature unknown
“”” implement next(self). “””
pass
def __reduce__(self, *args, **kwargs): # real signature unknown
“”” return state information for pickling. “””
pass
class __loader__(object):
“””
meta path import for built-in modules.
all methods are either class or static methods to avoid the need to
instantiate the class.
“””
def create_module(self, *args, **kwargs): # real signature unknown
“”” create a built-in module “””
pass
def exec_module(self, *args, **kwargs): # real signature unknown
“”” exec a built-in module “””
pass
def find_module(self, *args, **kwargs): # real signature unknown
“””
find the built-in module.
if ‘path’ is ever specified then the search is considered a failure.
this method is deprecated. use find_spec() instead.
“””
pass
def find_spec(self, *args, **kwargs): # real signature unknown
pass
def get_code(self, *args, **kwargs): # real signature unknown
“”” return none as built-in modules do not have code objects. “””
pass
def get_source(self, *args, **kwargs): # real signature unknown
“”” return none as built-in modules do not have source code. “””
pass
def is_package(self, *args, **kwargs): # real signature unknown
“”” return false as built-in modules are never packages. “””
pass
def load_module(self, *args, **kwargs): # real signature unknown
“””
load the specified module into sys.modules and return it.
this method is deprecated. use loader.exec_module instead.
“””
pass
def module_repr(module): # reliably restored by inspect
“””
return repr for the module.
the method is deprecated. the import machinery does the job itself.
“””
pass
def __init__(self, *args, **kwargs): # real signature unknown
pass
__weakref__ = property(lambda self: object(), lambda self, v: none, lambda self: none) # default
“””list of weak references to the object (if defined)”””
__dict__ = none # (!) real value is ”
# variables with complex values
ellipsis = none # (!) real value is ”
notimplemented = none # (!) real value is ”
__spec__ = none # (!) real value is ”
三.所有字符串数据类型举例
#变量名字变大写
tmp = “zhangyanlin”
tmp_new = tmp.upper()
print(tmp_new)
# 输出所有字符定义的所有类型
tmp.upper()
print(dir(tmp))
#[‘__add__’, ‘__class__’, ‘__contains__’, ‘__delattr__’, ‘__dir__’, ‘__doc__’, ‘__eq__’, ‘__format__’, ‘__ge__’, ‘__getattribute__’, ‘__getitem__’, ‘__getnewargs__’, ‘__gt__’, ‘__hash__’, ‘__init__’, ‘__iter__’, ‘__le__’, ‘__len__’, ‘__lt__’, ‘__mod__’, ‘__mul__’, ‘__ne__’, ‘__new__’, ‘__reduce__’, ‘__reduce_ex__’, ‘__repr__’, ‘__rmod__’, ‘__rmul__’, ‘__setattr__’, ‘__sizeof__’, ‘__str__’, ‘__subclasshook__’, ‘capitalize’, ‘casefold’, ‘center’, ‘count’, ‘encode’, ‘endswith’, ‘expandtabs’, ‘find’, ‘format’, ‘format_map’, ‘index’, ‘isalnum’, ‘isalpha’, ‘isdecimal’, ‘isdigit’, ‘isidentifier’, ‘islower’, ‘isnumeric’, ‘isprintable’, ‘isspace’, ‘istitle’, ‘isupper’, ‘join’, ‘ljust’, ‘lower’, ‘lstrip’, ‘maketrans’, ‘partition’, ‘replace’, ‘rfind’, ‘rindex’, ‘rjust’, ‘rpartition’, ‘rsplit’, ‘rstrip’, ‘split’, ‘splitlines’, ‘startswith’, ‘strip’, ‘swapcase’, ‘title’, ‘translate’, ‘upper’, ‘zfill’]
#把首字母变成大写
u1 = “zhang”
u2 = u1.capitalize()
print(u2)
#20定义20个位,不够用_补全。
u1 = “zhang”
u2 = u1.center(20 ,’_’)
print(u2)
#看zh在前10位出现了几次
u1 = “zhangyanlin is zhgod”
u2 = u1.count(‘zh’,0, 10)
print(u2)
#获取字符串中大于等于0的位置,小于2的位置
u1 = “zhang”
print(u1.endswith(‘h’,0,2))
#将tab转换成空格
u1 = “zhang\t123”
print(u1.expandtabs(20))
#找位数,相同只能找第一个出现的,没有想应得会反馈-1
u1 = “zhang hello”
print(u1.find(‘h’))
#站位符0和1是代表站位符
u1 = “name {0}, age {1}”
print(u1.format(“zhang”,18))
u1 = ” zhang is yan ”
#判断是否是字母
print(u1.isalpha())
#判断是否是数字
print(u1.isdigit())
#判断是否是字母和数字
print(u1.isalnum())
#判断是否是小写
print(u1.islower())
#判断是否是空格
print(u1.isspace())
#判断是不是标题
print(u1.istitle())
#判断是不是全部都是大写
print(u1.isupper())
#把列表里的内容连接一起
print(“_”.join(u1))
#内容左对齐,右侧填充
print(u1.ljust(1))
#内容变小写
print(u1.lower())
#移除左边的空格
print(u1.lstrip())
#移除右边的空格
print(u1.rstrip())
#把有空格的内容分割,变成元祖类型,从左找;rpartition从右开始分割
print(u1.partition(‘is’))
#替换,后面可以加替换几个,从左往右
print(u1.replace(‘zh’,’zh’))
#找到一个字符分割,从右,split从左分割
print(u1.rsplit(‘a’,1))
#是否以某个字符串开始开始
print(u1.startswith(‘z’))
#移除两边空格(strip)
print(u1.strip())
#大写变小写,小写变大写
print(u1.swapcase())
#变大写(upper)
print(u1.upper())
四.索引
u1 = “zhangyanlin”
print(u1[0])
print(u1[1])
print(u1[2])
print(u1[3])
print(u1[4])
print(u1[5])
五.切片
#切出zhan,注:0是代表第一位,4代表小于四,知道第三个数
u1 = “zhangyanlin”
print(u1[0:4])
六.循环切片
1.while使用
u1 = “zhangyanlin”
u2 = 0
while u2 < len(u1):
print(u1[u2])
u2+=1
2.for使用
#循环切片
u1 = “zhangyanlin”
for u2 in u1:
print(u2)
#循环切片,输出除了y
u1 =”zhangyanlin”
for u2 in u1:
if u2 ==”y”:
continue
print(u2)
#循环切片,输出到y后不执行
u1 =”zhangyanlin”
for u2 in u1:
if u2 ==”y”:
break
print(u2)