Python基本数据类型

运算符

1、算数运算:

2、比较运算:

3、赋值运算:

4、逻辑运算:

5、成员运算:

基本数据类型

1、数字

int

class int(object):

""" 返回表示该数字占用的最少位数 """
def bit_length(self): # real signature unknown; restored from __doc__
    """
    int.bit_length() -> int

    Number of bits necessary to represent self in binary.
    >>> bin(37)
    '0b100101'
    >>> (37).bit_length()
    6
    """
    return 0

""" 返回改复数的共轭复数 """
def conjugate(self, *args, **kwargs): # real signature unknown
    """ Returns self, the complex conjugate of any int. """
    pass

@classmethod # known case
def from_bytes(cls, bytes, byteorder, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__      
    pass

def to_bytes(self, length, byteorder, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__      
    pass

""" 绝对值 """
def __abs__(self, *args, **kwargs): # real signature unknown
    """ abs(self) """
    pass

def __add__(self, *args, **kwargs): # real signature unknown
    """ Return self+value. """
    pass

def __and__(self, *args, **kwargs): # real signature unknown
    """ Return self&value. """
    pass

def __bool__(self, *args, **kwargs): # real signature unknown
    """ self != 0 """
    pass

def __ceil__(self, *args, **kwargs): # real signature unknown
    """ Ceiling of an Integral returns itself. """
    pass

 """ 相除,得到商和余数组成的元组 """ 
def __divmod__(self, *args, **kwargs): # real signature unknown
    """ x.__divmod__(y) """ <==> divmod(x,y)
    pass

""" 比较两个数是否相等 """
def __eq__(self, *args, **kwargs): # real signature unknown
    """ Return self==value. """
    pass


""" 转换为浮点类型 """
def __float__(self, *args, **kwargs): # real signature unknown
    """ float(self) """
    pass

def __floordiv__(self, *args, **kwargs): # real signature unknown
    """ Return self//value. """
    pass

def __floor__(self, *args, **kwargs): # real signature unknown
    """ Flooring an Integral returns itself. """
    pass

def __format__(self, *args, **kwargs): # real signature unknown
    pass

def __getattribute__(self, *args, **kwargs): # real signature unknown
    """ Return getattr(self, name). """
    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 __index__(self, *args, **kwargs): # real signature unknown
    """ Return self converted to an integer, if self is suitable for use as an index into a list. """
    pass


 """ 构造方法,执行 x = 123 或 x = int(10) 时,自动调用,暂时忽略 """ 
def __init__(self, x, base=10): # known special case of int.__init__    
    # (copied from class doc)
    """
    pass

def __int__(self, *args, **kwargs): # real signature unknown
    """ int(self) """
    pass

def __invert__(self, *args, **kwargs): # real signature unknown
    """ ~self """
    pass

def __le__(self, *args, **kwargs): # real signature unknown
    """ Return self<=value. """
    pass

def __lshift__(self, *args, **kwargs): # real signature unknown
    """ Return self<<value. """
    pass

def __lt__(self, *args, **kwargs): # real signature unknown
    """ Return self<value. """
    pass

def __mod__(self, *args, **kwargs): # real signature unknown
    """ Return self%value. """
    pass

def __mul__(self, *args, **kwargs): # real signature unknown
    """ Return self*value. """
    pass

def __neg__(self, *args, **kwargs): # real signature unknown
    """ -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 __ne__(self, *args, **kwargs): # real signature unknown
    """ Return self!=value. """
    pass

def __or__(self, *args, **kwargs): # real signature unknown
    """ Return self|value. """
    pass


def __pos__(self, *args, **kwargs): # real signature unknown
    """ +self """
    pass

""" 表示x的y次幂 x_pow_(y) <==>  pow(x,y)  x**y   pow(x,y,z): (x**y) % z """
def __pow__(self, *args, **kwargs): # real signature unknown
    """ Return pow(self, value, mod). """
    pass

def __radd__(self, *args, **kwargs): # real signature unknown
    """ Return value+self. """
    pass

""" x.__rand__(y) <==> y&x """
def __rand__(self, *args, **kwargs): # real signature unknown
    """ Return value&self. """
    pass

def __rdivmod__(self, *args, **kwargs): # real signature unknown
    """ Return divmod(value, self). """
    pass

def __repr__(self, *args, **kwargs): # real signature unknown
    """ Return repr(self). """
    pass

def __rfloordiv__(self, *args, **kwargs): # real signature unknown
    """ Return value//self. """
    pass

def __rlshift__(self, *args, **kwargs): # real signature unknown
    """ Return value<<self. """
    pass

""" x.__rmod__(y) <==> y%x """
def __rmod__(self, *args, **kwargs): # real signature unknown
    """ Return value%self. """
    pass

""" x.__rmul__(y) <==> y*x """
def __rmul__(self, *args, **kwargs): # real signature unknown
    """ Return value*self. """
    pass

""" x.__ror__(y) <==> y|x """
def __ror__(self, *args, **kwargs): # real signature unknown
    """ Return value|self. """
    pass

def __round__(self, *args, **kwargs): # real signature unknown
    """
    Rounding an Integral returns itself.
    Rounding with an ndigits argument also returns an integer.
    """
    pass

def __rpow__(self, *args, **kwargs): # real signature unknown
    """ Return pow(value, self, mod). """
    pass

 """ x.__rrshift__(y) <==> x<<y """
def __rrshift__(self, *args, **kwargs): # real signature unknown
    """ Return value>>self. """
    pass

""" x.__rshift__(y) <==> x>>y """
def __rshift__(self, *args, **kwargs): # real signature unknown
    """ Return self>>value. """
    pass

def __rsub__(self, *args, **kwargs): # real signature unknown
    """ Return value-self. """
    pass

def __rtruediv__(self, *args, **kwargs): # real signature unknown
    """ Return value/self. """
    pass

def __rxor__(self, *args, **kwargs): # real signature unknown
    """ Return value^self. """
    pass

def __sizeof__(self, *args, **kwargs): # real signature unknown
    """ Returns size in memory, in bytes """
    pass

def __str__(self, *args, **kwargs): # real signature unknown
    """ Return str(self). """
    pass

def __sub__(self, *args, **kwargs): # real signature unknown
    """ Return self-value. """
    pass

def __truediv__(self, *args, **kwargs): # real signature unknown
    """ Return self/value. """
    pass

def __trunc__(self, *args, **kwargs): # real signature unknown
    """ Truncating an Integral returns itself. """
    pass

 """ x.__xor__(y) <==> x^y """
def __xor__(self, *args, **kwargs): # real signature unknown
    """ Return self^value. """
    pass

""" 分母 = 1 """
denominator = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
"""the denominator of a rational number in lowest terms"""

""" 虚数,无意义 """
imag = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
"""the imaginary part of a complex number"""

""" 分子 = 数字大小 ""
numerator = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
"""the numerator of a rational number in lowest terms"""

""" 实属,无意义 """
real = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
"""the real part of a complex number"""

2、布尔值

真或假
0 或 1

3、字符串(str)

  • 去除空白

  • 分割

  • 长度

  • 索引

  • 切片

    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.
        """
        return ""
    
    """ 内容居中,width:字符串的总宽度;fillchar:填充字符,默认填充字符为空格 """
    def center(self, width, fillchar=None): # real signature unknown; restored from __doc__
    """ 
        temp = "alex"
        temp_center = temp.center(10,"#")   ==>###alex###
    """          
    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""
    
    """ 是否已xx结尾 """
    def endswith(self, suffix, start=None, end=None): # real signature unknown; restored from __doc__
        """
        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 position.
        With optional end, stop comparing S at that position.
        suffix can also be a tuple of strings to try.
        """
        return False
    
    """ 将tab转成空格,一个tab对应8个空格""" 
    def expandtabs(self, tabsize=8): # real signature unknown; restored from __doc__
        """
        temp = "ale\tx"
        temp_expandtab = temp.expandtabs() ==> ale     x
        """
        return ""
    
    """ 查找子元素的索引位,如果没找到返回-1"""
    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.
        """
        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 '}').
        """
        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.
        """
        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.
        """
        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.
        """
        return False
    
    """ 是否是十进制 """
    def isdecimal(self): # real signature unknown; restored from __doc__
        """
        S.isdecimal() -> bool
    
        Return True if there are only decimal characters in S,
        False otherwise.
        """
        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.
        """
        return False
    
    def isidentifier(self): # real signature unknown; restored from __doc__
        """
        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" and "class".
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        return False
    
    """ 连接 """
    def join(self, iterable): # real signature unknown; restored from __doc__
        """
        temp = "aa"
        temp_find = temp.join("#@@") ==> #aa@aa@
        """
        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).
        """
        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 maketrans(self, *args, **kwargs): # real signature unknown
        """
        Return a translation table usable for str.translate().
    
        If there is only 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 in x will be mapped to the
        character at the same position in y. If there is a third argument, it
        must be a string, whose characters will be mapped to None in the result.
        """
        pass
    
    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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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.
        """
        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<=value. """
        pass
    
    def __lt__(self, *args, **kwargs): # real signature unknown
        """ Return self<value. """
        pass
    
    def __mod__(self, *args, **kwargs): # real signature unknown
        """ Return self%value. """
        pass
    
    def __mul__(self, *args, **kwargs): # real signature unknown
        """ Return self*value.n """
        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 __ne__(self, *args, **kwargs): # real signature unknown
        """ Return self!=value. """
        pass
    
    def __repr__(self, *args, **kwargs): # real signature unknown
        """ Return repr(self). """
        pass
    
    def __rmod__(self, *args, **kwargs): # real signature unknown
        """ Return value%self. """
        pass
    
    def __rmul__(self, *args, **kwargs): # real signature unknown
        """ Return self*value. """
        pass
    
    def __sizeof__(self): # real signature unknown; restored from __doc__
        """ S.__sizeof__() -> size of S in memory, in bytes """
        pass
    
    def __str__(self, *args, **kwargs): # real signature unknown
        """ Return str(self). """
        pass
    

4、列表(list)

创建

li_name = ["xiaoqiang","xiaoming"]

或者

li_name = list(["xiaoqiang","xiaoming"])
  • 索引

  • 切片

  • 追加

  • 删除

  • 长度

  • 循环

  • 包含

    class list(object):
    """
    list() -> new empty list
    list(iterable) -> new list initialized from iterable's items
    """
    def append(self, p_object): # real signature unknown; restored from __doc__
        """ L.append(object) -> None -- append object to end """
        pass
    
    def clear(self): # real signature unknown; restored from __doc__
        """ L.clear() -> None -- remove all items from L """
        pass
    
    def copy(self): # real signature unknown; restored from __doc__
        """ L.copy() -> list -- a shallow copy of L """
        return []
    
    def count(self, value): # real signature unknown; restored from __doc__
        """ L.count(value) -> integer -- return number of occurrences of value """
        return 0
    
    def extend(self, iterable): # real signature unknown; restored from __doc__
        """ L.extend(iterable) -> None -- extend list by appending elements from the iterable """
        pass
    
    def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__
        """
        L.index(value, [start, [stop]]) -> integer -- return first index of value.
        Raises ValueError if the value is not present.
        """
        return 0
    
    def insert(self, index, p_object): # real signature unknown; restored from __doc__
        """ L.insert(index, object) -- insert object before index """
        pass
    
    def pop(self, index=None): # real signature unknown; restored from __doc__
        """
        L.pop([index]) -> item -- remove and return item at index (default last).
        Raises IndexError if list is empty or index is out of range.
        """
        pass
    
    def remove(self, value): # real signature unknown; restored from __doc__
        """
        L.remove(value) -> None -- remove first occurrence of value.
        Raises ValueError if the value is not present.
        """
        pass
    
    def reverse(self): # real signature unknown; restored from __doc__
        """ L.reverse() -- reverse *IN PLACE* """
        pass
    
    def sort(self, key=None, reverse=False): # real signature unknown; restored from __doc__
        """ L.sort(key=None, reverse=False) -> None -- stable sort *IN PLACE* """
        pass
    
    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 __delitem__(self, *args, **kwargs): # real signature unknown
        """ Delete self[key]. """
        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, y): # real signature unknown; restored from __doc__
        """ x.__getitem__(y) <==> x[y] """
        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 __iadd__(self, *args, **kwargs): # real signature unknown
        """ Implement self+=value. """
        pass
    
    def __imul__(self, *args, **kwargs): # real signature unknown
        """ Implement self*=value. """
        pass
    
    def __init__(self, seq=()): # known special case of list.__init__
        """
        list() -> new empty list
        list(iterable) -> new list initialized from iterable's items
        # (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<=value. """
        pass
    
    def __lt__(self, *args, **kwargs): # real signature unknown
        """ Return self<value. """
        pass
    
    def __mul__(self, *args, **kwargs): # real signature unknown
        """ Return self*value.n """
        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 __ne__(self, *args, **kwargs): # real signature unknown
        """ Return self!=value. """
        pass
    
    def __repr__(self, *args, **kwargs): # real signature unknown
        """ Return repr(self). """
        pass
    
    def __reversed__(self): # real signature unknown; restored from __doc__
        """ L.__reversed__() -- return a reverse iterator over the list """
        pass
    
    def __rmul__(self, *args, **kwargs): # real signature unknown
        """ Return self*value. """
        pass
    
    def __setitem__(self, *args, **kwargs): # real signature unknown
        """ Set self[key] to value. """
        pass
    
    def __sizeof__(self): # real signature unknown; restored from __doc__
        """ L.__sizeof__() -- size of L in memory, in bytes """
        pass
    
    __hash__ = None
    

5、元祖(tuple)

创建

li_name = ("aa","bb")

或者

li_name = tuple(("aa","bb"))

基本操作:

  • 索引

  • 切片

  • 循环

  • 长度

  • 包含

    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<=value. """
        pass
    
    def __lt__(self, *args, **kwargs): # real signature unknown
        """ Return self<value. """
        pass
    
    def __mul__(self, *args, **kwargs): # real signature unknown
        """ Return self*value.n """
        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 __ne__(self, *args, **kwargs): # real signature unknown
        """ Return self!=value. """
        pass
    
    def __repr__(self, *args, **kwargs): # real signature unknown
        """ Return repr(self). """
        pass
    
    def __rmul__(self, *args, **kwargs): # real signature unknown
        """ Return self*value. """
        pass
    

6、字典

创建

student = {"name": "xiaoming", "age": 19}

或者

student = dict({"name": "xiaoming", "age": 19})

常用操作:

  • 索引

  • 新增

  • 删除

  • 键、值、键值对

  • 循环

  • 长度

    class dict(object):
    """
    dict() -> new empty dictionary
    dict(mapping) -> new dictionary initialized from a mapping object's
        (key, value) pairs
    dict(iterable) -> new dictionary initialized as if via:
        d = {}
        for k, v in iterable:
            d[k] = v
    dict(**kwargs) -> new dictionary initialized with the name=value pairs
        in the keyword argument list.  For example:  dict(one=1, two=2)
    """
    def clear(self): # real signature unknown; restored from __doc__
        """ D.clear() -> None.  Remove all items from D. """
        pass
    
    def copy(self): # real signature unknown; restored from __doc__
        """ D.copy() -> a shallow copy of D """
        pass
    
    @staticmethod # known case
    def fromkeys(*args, **kwargs): # real signature unknown
        """ Returns a new dict with keys from iterable and values equal to value. """
        pass
    
    def get(self, k, d=None): # real signature unknown; restored from __doc__
        """ D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None. """
        pass
    
    def items(self): # real signature unknown; restored from __doc__
        """ D.items() -> a set-like object providing a view on D's items """
        pass
    
    def keys(self): # real signature unknown; restored from __doc__
        """ D.keys() -> a set-like object providing a view on D's keys """
        pass
    
    def pop(self, k, d=None): # real signature unknown; restored from __doc__
        """
        D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
        If key is not found, d is returned if given, otherwise KeyError is raised
        """
        pass
    
    def popitem(self): # real signature unknown; restored from __doc__
        """
        D.popitem() -> (k, v), remove and return some (key, value) pair as a
        2-tuple; but raise KeyError if D is empty.
        """
        pass
    
    def setdefault(self, k, d=None): # real signature unknown; restored from __doc__
        """ D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D """
        pass
    
    def update(self, E=None, **F): # known special case of dict.update
        """
        D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
        If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
        If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
        In either case, this is followed by: for k in F:  D[k] = F[k]
        """
        pass
    
    def values(self): # real signature unknown; restored from __doc__
        """ D.values() -> an object providing a view on D's values """
        pass
    
    def __contains__(self, *args, **kwargs): # real signature unknown
        """ True if D has a key k, else False. """
        pass
    
    def __delitem__(self, *args, **kwargs): # real signature unknown
        """ Delete self[key]. """
        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, y): # real signature unknown; restored from __doc__
        """ x.__getitem__(y) <==> x[y] """
        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 __init__(self, seq=None, **kwargs): # known special case of dict.__init__
        """
        dict() -> new empty dictionary
        dict(mapping) -> new dictionary initialized from a mapping object's
            (key, value) pairs
        dict(iterable) -> new dictionary initialized as if via:
            d = {}
            for k, v in iterable:
                d[k] = v
        dict(**kwargs) -> new dictionary initialized with the name=value pairs
            in the keyword argument list.  For example:  dict(one=1, two=2)
        # (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<=value. """
        pass
    
    def __lt__(self, *args, **kwargs): # real signature unknown
        """ Return self<value. """
        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 __ne__(self, *args, **kwargs): # real signature unknown
        """ Return self!=value. """
        pass
    
    def __repr__(self, *args, **kwargs): # real signature unknown
        """ Return repr(self). """
        pass
    
    def __setitem__(self, *args, **kwargs): # real signature unknown
        """ Set self[key] to value. """
        pass
    
    def __sizeof__(self): # real signature unknown; restored from __doc__
        """ D.__sizeof__() -> size of D in memory, in bytes """
        pass
    
    __hash__ = None
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值