Python基础(二)

本章内容:

  • Python 运算符(算术运算、比较运算、赋值运算、逻辑运算、成员运算)
  • 基本数据类型(数字、布尔值、字符串、列表、元组、字典、set集合)
  • for 循环
  • enumrate
  • range和xrange
  • 编码与进制转换

Python 运算符

1、算术运算:

2、比较运算:

3、赋值运算:

4、逻辑运算:

5、成员运算:

基本数据类型

1、数字

int(整型)

在32位机器上,整数的位数为32位,取值范围为-2**31~2**31-1,即-2147483648~2147483647
  在64位系统上,整数的位数为64位,取值范围为-2**63~2**63-1,即-9223372036854775808~9223372036854775807

#返回表示该数字的时占用的最少位数
		>>> (951).bit\_length()
		10

#返回绝对值 
		>>> (95).\_\_abs\_\_()
		95
		>>> (-95).\_\_abs\_\_()
		95

#用来区分数字和字符串的
		>>> (95).\_\_add\_\_(1)
		96
		>>> (95).\_\_add\_\_("1")
		NotImplemented

#判断一个整数对象是否为0,如果为0,则返回False,如果不为0,则返回True
		>>> (95).\_\_bool\_\_()
		True
		>>> (0).\_\_bool\_\_()
		False

#判断两个值是否相等
		>>> (95).\_\_eq\_\_(95)
		True
		>>> (95).\_\_eq\_\_(9)
		False

#判断是否不等于
		>>> (95).\_\_ne\_\_(9)
		 True
		>>> (95).\_\_ne\_\_(95)
		False

#判断是否大于等于
		>>> (95).\_\_ge\_\_(9)
		True
		>>> (95).\_\_ge\_\_(99)
		False

#判断是否大于
		>>> (95).\_\_gt\_\_(9)
		True
		>>> (95).\_\_gt\_\_(99)
		False

#判断是否小于等于
		>>> (95).\_\_le\_\_(99)
		True
		>>> (95).\_\_le\_\_(9)
		False

#判断是否小于
		>>> (95).\_\_lt\_\_(9)
		 False
		>>> (95).\_\_lt\_\_(99)
		True

#加法运算
		>>> (95).\_\_add\_\_(5)
		100

#减法运算
		>>> (95).\_\_sub\_\_(5)
		90

#乘法运算
		>>> (95).\_\_mul\_\_(10)
		950

#除法运算
		>>> (95).\_\_truediv\_\_(5)
		19.0

#取模运算
		>>> (95).\_\_mod\_\_(9)
		5

#幂运算
		>>> (2).\_\_pow\_\_(10)
		1024

#整除,保留结果的整数部分
		>>> (95).\_\_floordiv\_\_(9)
		>>>

#转换为整型
		>>> (9.5).\_\_int\_\_()
		9

#返回一个对象的整数部分
		>>> (9.5).\_\_trunc\_\_()
		9

#将正数变为负数,将负数变为正数
		>>> (95).\_\_neg\_\_()
		-95
		>>> (-95).\_\_neg\_\_()
		95

#将一个正数转为字符串
		>>> a = 95 
		>>> a = a.\_\_str\_\_()
		>>> print(type(a))
		 <class 'str'>

#将一个整数转换成浮点型
		>>> (95).\_\_float\_\_()
		95.0

#转换对象的类型
		>>> (95).\_\_format\_\_('f')
		'95.000000'
		>>> (95).\_\_format\_\_('b')
		'1011111'

#在内存中占多少个字节
		>>> a = 95
		>>> a.\_\_sizeof\_\_()
		28

class int(object):
    """
    int(x=0) -> integer
    int(x, base=10) -> integer

    Convert a number or string to an integer, or return 0 if no arguments
    are given.  If x is a number, return x.\_\_int\_\_().  For floating point
    numbers, this truncates towards zero.

    If x is not a number or if base is given, then x must be a string,
    bytes, or bytearray instance representing an integer literal in the
    given base.  The literal can be preceded by '+' or '-' and be surrounded
    by whitespace.  The base defaults to 10.  Valid bases are 0 and 2-36.
    Base 0 means to interpret the base from the string as an integer literal.
    >>> int('0b100', base=0)
    """
    def bit\_length(self): # real signature unknown; restored from \_\_doc\_\_
        """
        int.bit\_length() -> int

        Number of bits necessary to represent self in binary.
        """
        """
        表示该数字返回时占用的最少位数

        >>> (951).bit\_length()
        10
        """
        return 0

    def conjugate(self, \*args, \*\*kwargs): # real signature unknown
        """ Returns self, the complex conjugate of any int."""

        """
        返回该复数的共轭复数
 
        #返回复数的共轭复数
        >>> (95 + 11j).conjugate()
        (95-11j)
        #返回复数的实数部分
        >>> (95 + 11j).real
        95.0
        #返回复数的虚数部分
        >>> (95 + 11j).imag
        11.0
        """
        pass

    @classmethod # known case
    def from\_bytes(cls, bytes, byteorder, \*args, \*\*kwargs): # real signature unknown; NOTE: unreliably restored from \_\_doc\_\_
        """
        int.from\_bytes(bytes, byteorder, \*, signed=False) -> int

        Return the integer represented by the given array of bytes.

        The bytes argument must be a bytes-like object (e.g. bytes or bytearray).

        The byteorder argument determines the byte order used to represent the
        integer.  If byteorder is 'big', the most significant byte is at the
        beginning of the byte array.  If byteorder is 'little', the most
        significant byte is at the end of the byte array.  To request the native
        byte order of the host system, use \`sys.byteorder' as the byte order value.

        The signed keyword-only argument indicates whether two's complement is
        used to represent the integer.
        """
        """
        这个方法是在Python3.2的时候加入的,python官方给出了下面几个例子:
        >>> int.from\_bytes(b'\\x00\\x10', byteorder='big')
        >>> int.from\_bytes(b'\\x00\\x10', byteorder='little')
        >>> int.from\_bytes(b'\\xfc\\x00', byteorder='big', signed=True)
        -1024
        >>> int.from\_bytes(b'\\xfc\\x00', byteorder='big', signed=False)
        >>> int.from\_bytes(\[255, 0, 0\], byteorder='big')
        """
        pass

    def to\_bytes(self, length, byteorder, \*args, \*\*kwargs): # real signature unknown; NOTE: unreliably restored from \_\_doc\_\_
        """
        int.to\_bytes(length, byteorder, \*, signed=False) -> bytes

        Return an array of bytes representing an integer.

        The integer is represented using length bytes.  An OverflowError is
        raised if the integer is not representable with the given number of
        bytes.

        The byteorder argument determines the byte order used to represent the
        integer.  If byteorder is 'big', the most significant byte is at the
        beginning of the byte array.  If byteorder is 'little', the most
        significant byte is at the end of the byte array.  To request the native
        byte order of the host system, use \`sys.byteorder' as the byte order value.

        The signed keyword-only argument determines whether two's complement is
        used to represent the integer.  If signed is False and a negative integer
        is given, an OverflowError is raised.
        """
        """
        python官方给出了下面几个例子:
        >>> (1024).to\_bytes(2, byteorder='big')
        b'\\x04\\x00'
        >>> (1024).to\_bytes(10, byteorder='big')
        b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x04\\x00'
        >>> (-1024).to\_bytes(10, byteorder='big', signed=True)
        b'\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xfc\\x00'
        >>> x = 1000
        >>> x.to\_bytes((x.bit\_length() // 8) + 1, byteorder='little')
        b'\\xe8\\x03'
        """
        pass

    def \_\_abs\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ abs(self)"""

        """
        返回一个绝对值

        >>> (95).\_\_abs\_\_()
        -95
        >>> (-95).\_\_abs\_\_()
        95
        """
        pass

    def \_\_add\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self+value."""

        """
        加法,也可区分数字和字符串

        >>> (95).\_\_add\_\_(1)
        96
        >>> (95).\_\_add\_\_("1")
        NotImplemented
        >>>
        """
        pass

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

    def \_\_bool\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ self != 0 """

        """
        判断一个整数对象是否为0,如果为0,则返回False,如果不为0,则返回True

        >>> (95).\_\_bool\_\_()
        True
        >>> (0).\_\_bool\_\_()
        False
        """
        pass

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

    def \_\_divmod\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return divmod(self, value). """
        """
        返回一个元组,第一个元素为商,第二个元素为余数

        >>> (9).\_\_divmod\_\_(5)
        (1, 4)
        """
        pass

    def \_\_eq\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self==value. """
        """
        判断两个值是否相等

        >>> (95).\_\_eq\_\_(95)
        True
        >>> (95).\_\_eq\_\_(9)
        False
        """
        pass

    def \_\_float\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ float(self) """
        """
        将一个整数转换成浮点型

        >>> (95).\_\_float\_\_()
        95.0
        """
        pass

    def \_\_floordiv\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self//value. """
        """
        整除,保留结果的整数部分

        >>> (95).\_\_floordiv\_\_(9)
        10
        """
        pass

    def \_\_floor\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Flooring an Integral returns itself. """
        """
        返回本身

        >>> (95).\_\_floor\_\_()
        95
        """
        pass

    def \_\_format\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """
        转换对象的类型

        >>> (95).\_\_format\_\_('f')
        '95.000000'
        >>> (95).\_\_format\_\_('b')
        '1011111'
        """
        pass

    def \_\_getattribute\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return getattr(self, name). """
        """
        判断这个类中是否包含这个属性,如果包含则打印出值,如果不包含,就报错了

        >>> (95).\_\_getattribute\_\_('\_\_abs\_\_')
        <method-wrapper '\_\_abs\_\_' of int object at 0x9f93c0>
        >>> (95).\_\_getattribute\_\_('\_\_aaa\_\_')
        Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        AttributeError: 'int' object has no attribute '\_\_aaa\_\_'
        """
        pass

    def \_\_getnewargs\_\_(self, \*args, \*\*kwargs): # real signature unknown
        pass

    def \_\_ge\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self>=value. """
        """
        判断是否大于等于

        >>> (95).\_\_ge\_\_(9)
        True
        >>> (95).\_\_ge\_\_(99)
        False
        """
        pass

    def \_\_gt\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self>value. """
        """
        判断是否大于

        >>> (95).\_\_gt\_\_(9)
        True
        >>> (95).\_\_gt\_\_(99)
        False
        """
        pass

    def \_\_hash\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return hash(self). """
        """
        计算哈希值,整数返回本身

        >>> (95).\_\_hash\_\_()
        95
        >>> (95.95).\_\_hash\_\_()
        2190550858753015903
        """
        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

    def \_\_init\_\_(self, x, base=10): # known special case of int.\_\_init\_\_
        """
         这个是一个类的初始化方法,当int类被实例化的时候,这个方法默认就会被执行
        """
        """
        int(x=0) -> integer
        int(x, base=10) -> integer

        Convert a number or string to an integer, or return 0 if no arguments
        are given.  If x is a number, return x.\_\_int\_\_().  For floating point
        numbers, this truncates towards zero.

        If x is not a number or if base is given, then x must be a string,
        bytes, or bytearray instance representing an integer literal in the
        given base.  The literal can be preceded by '+' or '-' and be surrounded
        by whitespace.  The base defaults to 10.  Valid bases are 0 and 2-36.
        Base 0 means to interpret the base from the string as an integer literal.
        >>> int('0b100', base=0)
        # (copied from class doc)
        """   
        pass

    def \_\_int\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ int(self) """
        """
        转换为整型

        >>> (9.5).\_\_int\_\_()
        9
        """
        pass

    def \_\_invert\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ ~self """

        pass

    def \_\_le\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self<=value. """
        """
        判断是否小于等于
     
        >>> (95).\_\_le\_\_(99)
        True
        >>> (95).\_\_le\_\_(9)
        False
        """
        pass

    def \_\_lshift\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self<<value. """
        """
        用于二进制位移,这个是向左移动

        >>> bin(95)
        '0b1011111'
        >>> a = (95).\_\_lshift\_\_(2)
        >>> bin(a)
        '0b101111100'
         >>> 
        """
        pass

    def \_\_lt\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self<value. """
        """
        判断是否小于

        >>> (95).\_\_lt\_\_(9)
        False
        >>> (95).\_\_lt\_\_(99)
        True
        """
        pass

    def \_\_mod\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self%value. """
        """
        取模 %

        >>> (95).\_\_mod\_\_(9)
        """
        pass

    def \_\_mul\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self\*value. """
        """
        乘法 \*

        >>> (95).\_\_mul\_\_(10)
        """
        pass

    def \_\_neg\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ -self """
        """
        将正数变为负数,将负数变为正数

        >>> (95).\_\_neg\_\_()
        -95
        >>> (-95).\_\_neg\_\_()
        95
        """
        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. """
        """
        不等于

        >>> (95).\_\_ne\_\_(9)
        True
        >>> (95).\_\_ne\_\_(95)
        False
        """
        pass

    def \_\_or\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self|value. """
        """
        二进制或的关系,只要有一个为真,就为真

        >>> a = 4
        >>> b = 0
        >>> a.\_\_or\_\_(b)     # a --> 00000100        b --> 00000000
        >>> b = 1           # b --> 00000001
        >>> a.\_\_or\_\_(b)
        """
        pass

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

    def \_\_pow\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return pow(self, value, mod). """
        """
        幂

        >>> (2).\_\_pow\_\_(10)
        1024
        """    
        pass

    def \_\_radd\_\_(self, \*args, \*\*kwargs): # real signatre unknown
        """ Return value+self. """
        """
        加法,将value放在前面

        >>> a.\_\_radd\_\_(b)       # 相当于 b+a 
        """
        pass

    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

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

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

    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

    def \_\_rrshift\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return value>>self. """
        pass

    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 """
        """
        在内存中占多少个字节

        >>> a = 95
        >>> a.\_\_sizeof\_\_()
        28
        """
        pass

    def \_\_str\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return str(self). """
        """
        将一个正数转为字符串

        >>> a = 95 
        >>> a = a.\_\_str\_\_()
        >>> print(type(a))
        <class 'str'>
        """
        pass

    def \_\_sub\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self-value. """
        """
        减法运算

        >>> (95).\_\_sub\_\_(5)
        90
        """
        pass

    def \_\_truediv\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self/value. """
        """
        除法运算

        >>> (95).\_\_truediv\_\_(5)
        19.0
        """
        pass

    def \_\_trunc\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Truncating an Integral returns itself. """
        """
        返回一个对象的整数部分

        >>> (95.95).\_\_trunc\_\_()
        95
        """
        pass
    def \_\_xor\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self^value. """
        """
        将对象与值进行二进制的或运算,一个为真,就为真

        >>> a = 4
        >>> b = 1
        >>> a.\_\_xor\_\_(b)
        >>> c = 0
        >>> a.\_\_xor\_\_(c)
        """

        pass

    denominator \= property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
    """ 分母 = 1 """
    """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"""

int

2、布尔值

真或假

1 或 0

3、字符串

“Hello World!”

s = "nick"

#索引
print(s\[0\])
print(s\[1\])
print(s\[2\])
print(s\[3\])

#长度
ret = len(s)
print(ret)

#切片
print(s\[1:3\])
print(s.rsplit("ic"))

#替换
name = "Nick is good, Today is nice day."
a = name.replace("good","man")
print(a)

#连接两个字符串
li = \["nick","serven"\]
a = "".join(li)
b = "\_".join(li)
print(a)
print(b)

#指定的分隔符将字符串进行分割
a = s.rpartition("i")
print(a)

#分割,前,中,后三部分 
name = "Nick is good, Today is nice day."
a = name.partition("good")
print(a)

#for循环
for i in s:
    print(i)
for i in range(5):
    print(i)

# 反转
s = 'ssssssssss111'
print(s\[::-1\])  # 111ssssssssss

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\_\_
        """
        首字母变大写
        name = "nick is good, Today is nice day."
        a = name.capitalize()
                print(a)
        """
        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\_\_
        """
                首字母变小写
        name \= "Nick is good, Today is nice day.
        a =name.casefold()
                print(a)
        """
        S.casefold() -> str
        
        Return a version of S suitable for caseless comparisons.
        """
        return ""

    def center(self, width, fillchar=None): # real signature unknown; restored from \_\_doc\_\_
        """
        内容居中,width:总长度;fillchar:空白处填充内容,默认无。
        name = "Nick is good, Today is nice day.
                a = name.center(60,'$')
                print(a)
        """
        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\_\_
        """
        子序列个数,0到26中n出现了几次。
                name \= "nck is good, Today is nice day.
                a = name.count("n",0,26)
                print(a)
        """
        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\_\_
        """
    """ 
                编码,针对unicode.
                temp \= "烧饼
                temp.encode("unicode")
        """
        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 endswith(self, suffix, start=None, end=None): # real signature unknown; restored from \_\_doc\_\_
        """
    """ 
        是否以XX结束,0到4是否以k结尾
        name \= "nck is good, Today is nice day.
        a = name.endswith("k",0,4)
        print(a)
        """
        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

    def expandtabs(self, tabsize=8): # real signature unknown; restored from \_\_doc\_\_
        """
    """ 
        将tab转换成空格,默认一个tab转换成8个空格 
        a \= n.expandtabs()
        b \= n.expandtabs(16)
        print(a)
        print(b)
        """
        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.
        """
        return ""

    def find(self, sub, start=None, end=None): # real signature unknown; restored from \_\_doc\_\_
        """
    """ 
        寻找子序列位置,如果没找到,返回 \-1。
        name \= "nck is good, Today is nice day. "
        a \= name.find("nickk")
        print(a)
        """
        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
        """
    """ 
    字符串格式化,动态参数
    name \= "nck is good, Today is nice day. "
    a \= name.format()
    print(a)
    """
        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\_\_
        """
        """
        dict \= {'Foo': 54.23345}
fmt \= "Foo = {Foo:.3f}"
result \= fmt.format\_map(dict)
print(result)   #Foo = 54.233
"""
        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\_\_
        """
    """
    #子序列位置,如果没有找到就报错
    name = "nck is good, Today is nice day. "
    a \= name.index("nick")
    print(a)
    """
        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\_\_
        """
    """ 
    是否是字母和数字
    name \= "nck is good, Today is nice day. "
    a \= name.isalnum()
    print(a)
    """
        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\_\_
        """
    """ 
    是否是字母
    name \= "nck is good, Today is nice day. "
    a \= name.isalpha()
    print(a)
    """
        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\_\_
        """
    检查字符串是否只包含十进制字符。这种方法只存在于unicode对象。
    """
        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\_\_
        """
    """ 
    是否是数字
    name = "nck is good, Today is nice day. "
    a = name.isdigit()
    print(a)
    """
        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\_\_
        """
    """
    是否小写 
    name = "nck is good, Today is nice day. "
    a = name.islower()
    print(a)
    """
        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\_\_
        """
    """
    检查是否只有数字字符组成的字符串
    name = "111111111111111”
    a = name.isnumeric()
    print(a)
    """
        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\_\_
        """
    """
    判断字符串中所有字符是否都属于可见字符
    name = "nck is good, Today is nice day. "
    a = name.isprintable()
    print(a)
        """
        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\_\_
        """
    """
    字符串是否只由空格组成
    name = "  "
    a = name.isspace()
    print(a)
    """
        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\_\_
        """
    """
    检测字符串中所有的单词拼写首字母是否为大写,且其他字母为小写
    name = "Nick, Today."
    a = name.istitle()
    print(a)
    """
    """
        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\_\_
        """
    """
    检测字符串中所有的字母是否都为大写
    name \= "NICK"
    a \= name.isupper()
    print(a)
    """
        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\_\_
        """
    """ 
    连接两个字符串
    li \= \["nick","serven"\]
    a \= "".join(li)
    b \= "\_".join(li)
    print(a)
    print(b)
    """
        S.join(iterable) -> str
        
        Return a string which is the concatenation of the strings in the
        iterable.  The separator between elements is S.
        """
        return ""

    def ljust(self, width, fillchar=None): # real signature unknown; restored from \_\_doc\_\_
        """
    """ 
    向左对齐,右侧填充
    name \= "nck is good, Today is nice day. "
    a \= name.ljust(66)
    print(a)
    """
        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\_\_
        """
    """ 
    容左对齐,右侧填充
    name \= "NiNi"
    a \= name.lower()
    print(a)
    """
        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
        """
    """
    用于创建字符映射的转换表,对于接受两个参数的最简单的调用方式,第一个参数是字符串,表示需要转换的字符,第二个参数也是字符串表示转换的目标。
    from string import maketrans
    intab \= "aeiou"
    outtab \= "12345"
    trantab \= maketrans(intab, outtab)
    str \= "this is string example....wow!!!";
    print str.translate(trantab);
    """
        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\_\_
        """
    """ 
    分割,前,中,后三部分 
    name \= "Nick is good, Today is nice day."
    a \= name.partition("good")
    print(a)
    """
        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\_\_
        """
    """ 
    替换
    name \= "Nick is good, Today is nice day."
    a \= name.replace("good","man")
    print(a)
    """
        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\_\_
        """
    """
    返回字符串最后一次出现的位置,如果没有匹配项则返回\-1
    """
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\_\_
        """
    """
    返回子字符串 str 在字符串中最后出现的位置,如果没有匹配的字符串会报异常
        """
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\_\_
        """
    """
    返回一个原字符串右对齐,并使用空格填充至长度 width 的新字符串。如果指定的长度小于字符串的长度则返回原字符串
        str \= "this is string example....wow!!!"
print(str.rjust(50, '$'))
        """
        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\_\_
        """
    """
    指定分隔符对字符串进行切片
    name \= "Nick is good, Today is nice day."
    a \= name.rsplit("is")
    print(a)
    """
        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\_\_
        """
    """
    删除 string 字符串末尾的指定字符(默认为空格)
    """
        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\_\_
        """
    """
    通过指定分隔符对字符串进行切片
    str \= "Line1-abcdef \\nLine2-abc \\nLine4-abcd";
    print str.split( );
    print str.split(' ', 1 );
        """
        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\_\_
        """
    """
    检查字符串是否是以指定子字符串开头,如果是则返回 True,否则返回 False
        """
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\_\_
        """
    """
    返回指定长度的字符串,原字符串右对齐,前面填充0
    """
        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
    

str

4、列表

list = [‘Google’, ‘baidu’, ‘taobao’]

#在列表末尾添加新的对象
list = \['Google', 'baidu', 'T'\]
list.append('taobao')
print(list)
 
#将指定对象插入列表
list = \['Google', 'baidu', 'T','baidu'\]
list.insert(1,"Nick")
print(list)
 
#在列表末尾追加另一个序列中的多个值
list = \['Google', 'baidu', 'T','baidu'\]
list2 = \['nick','baidu'\]
list.extend(list2)
print(list)
 
 
#统计某个元素在列表中出现的次数
list = \['Google', 'baidu', 'T','baidu'\]
a = list.count('baidu')
print(a)
 
#从列表中找出某个值第一个匹配项的索引位置
list = \['Google', 'baidu', 'T','baidu'\]
a = list.index('baidu')
print(a)
 
 
#移除列表中的一个元素(默认最后一个元素)
list = \['Google', 'baidu', 'T','baidu'\]
list.pop()
print(list)
 
#移除列表中某个值的第一个匹配项
list = \['Google', 'baidu', 'T','baidu'\]
list.remove('baidu')
print(list)
 
#清空列表
list = \['Google', 'baidu', 'T'\]
list.clear()
print(list)

#删除指定索引位置
list = \['Google', 'baidu', 'T','baidu'\]
del list\[2\]
print(list)

list = \['Google', 'baidu', 'T','baidu'\]
del list\[1:3\]    -->顾头不顾尾
print(list)
 
 
#复制列表
list = \['Google', 'baidu', 'T'\]
list2 = list.copy()
print(list2)
 
#对原列表进行排序
list = \['Google', 'baidu', 'T','baidu'\]
list.sort()
print(list)
 
#反向列表中元素
list = \['Google', 'baidu', 'T','baidu'\]
list.reverse()
print(list)

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\_\_
        """
        用于在列表末尾添加新的对象
        list = \['Google', 'baidu', 'T'\]
        list.append('taobao')
        print(list)
        """
        """ L.append(object) -> None -- append object to end """
        pass

def clear(self): # real signature unknown; restored from \_\_doc\_\_
    """
        用于清空列表
        list = \['Google', 'baidu', 'T'\]
        list.clear()
        print(list)
        """
        """ L.clear() -> None -- remove all items from L """
        pass

def copy(self): # real signature unknown; restored from \_\_doc\_\_
    """
        用于复制列表
        list = \['Google', 'baidu', 'T'\]
        list2 = list.copy()
        print(list2)
    """
        """ L.copy() -> list -- a shallow copy of L """
        return \[\]

def count(self, value): # real signature unknown; restored from \_\_doc\_\_
    """
        统计某个元素在列表中出现的次数
        list = \['Google', 'baidu', 'T','baidu'\]
        a = list.count('baidu')
        print(a)
        """
        """ L.count(value) -> integer -- return number of occurrences of value """
        return 0

def extend(self, iterable): # real signature unknown; restored from \_\_doc\_\_
    """
        在列表末尾一次性追加另一个序列中的多个值
        list = \['Google', 'baidu', 'T','baidu'\]
        list2 = \['nick','baidu'\]
        list.extend(list2)
        print(list)
        """
        """ 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\_\_
        """
    """
    用于从列表中找出某个值第一个匹配项的索引位置
    list \= \['Google', 'baidu', 'T','baidu'\]
        a \= list.index('baidu')
        print(a)
        """
        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\_\_
    """
    用于将指定对象插入列表
    list = \['Google', 'baidu', 'T','baidu'\]
        list.insert(1,"Nick")
        print(list)
    """
        """ L.insert(index, object) -- insert object before index """
        pass

    def pop(self, index=None): # real signature unknown; restored from \_\_doc\_\_
        """
    移除列表中的一个元素(默认最后一个元素)。
    list = \['Google', 'baidu', 'T','baidu'\]
        list.pop()
        print(list)
    """
    """
        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\_\_
        """
    移除列表中某个值的第一个匹配项
    list = \['Google', 'baidu', 'T','baidu'\]
        list.remove('baidu')
        print(list)
    """
    """
        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\_\_
    """
    用于反向列表中元素
    list = \['Google', 'baidu', 'T','baidu'\]
        list.reverse()
        print(list)
    """
        """ L.reverse() -- reverse \*IN PLACE\* """
        pass

def sort(self, key=None, reverse=False): # real signature unknown; restored from \_\_doc\_\_
    """
    用于对原列表进行排序
    list = \['Google', 'baidu', 'T','baidu'\]
        list.sort()
        print(list)
    """
        """ 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

list

5、元组(不可修改)

name = ('nick','jenney')  

#索引
name = ('nick','jenney')
a = name\[0\]
print(a)

#获取指定元素的索引位置
name = ('nick','jenney')
a = name.index('nick')
print(a)

#切片
name = ('nick','jenney')
a = name\[0:1\]
print(a)

#计算元素出现的个数
name = ('nick','jenney')
a = name.count('nick')
print(a)

#长度
name = ('nick','jenney')
a = len(name)
print(a)

#for循环
name = ('nick','jenney')
for i in name:
    print(i)

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\_\_
        """
        计算元素出现的个数
        name = ('nick','jenney')
        a = name.count('nick')
       print(a)
        """
        """ 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\_\_
        """
    获取指定元素的索引位置
    name = ('nick','jenney')
        a = name.index('nick')
        print(a)
    """
    """
        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

tuple

6、字典(无序)

user\_info = {  
    "name":"nick",  
    "age":18,  
    "job":"pythoner"  
}  

user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}

#根据key获取值
a = user\_info.get("age")
print(a)
a = user\_info.get("Age",19")
print(a)

#所有的key 列表
a = user\_info.keys()
print(a)

#所有的值,values
a = user\_info.values()
print(a)

#所有项的列表形式 
a = user\_info.items()
print(a)


#获取并在字典中移除
user\_info.pop('age')
print(user\_info)

#随机并在字典中移除
user\_info.popitem()
user\_info.popitem()
print(user\_info)

#清除内容
a = user\_info.clear()
print(a)


#浅拷贝
a = user\_info.copy()
print(a)

#如果key不存在,则创建,如果存在,则返回已存在的值且不修改 
a = user\_info.setdefault("age")
print(a)
user\_info.setdefault("cool")
print(user\_info)

#从序列键和值设置为value来创建一个新的字典
a = dict.fromkeys(user\_info)
print(("new dict: %s") % str(a))


#更新(两个字典)
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
user\_info2 = {
    "wage":800000000,
    "drem":"The knife girl"
}
user\_info.update(user\_info2)
print(user\_info)

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\_\_
""" 
清除内容
user\_info = {
"name":"nick",
"age":18,
"job":"pythoner"
a = user\_info.clear()
print(a)
"""
        """ D.clear() -> None.  Remove all items from D. """
        pass

def copy(self): # real signature unknown; restored from \_\_doc\_\_
"""
浅拷贝
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
a = user\_info.copy()
print(a)
"""
        """ D.copy() -> a shallow copy of D """
        pass

    @staticmethod # known case
def fromkeys(\*args, \*\*kwargs): # real signature unknown
"""
从序列键和值设置为value来创建一个新的字典
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
a = dict.fromkeys(user\_info)
print(("new dict: %s") % str(a))
"""
        """ 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\_\_
""" 
根据key获取值,d是默认值 
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
a = user\_info.get("age")
print(a)
"""
        """ 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\_\_
""" 
所有项的列表形式 
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
a = user\_info.items()
print(a)
"""
        """ D.items() -> a set-like object providing a view on D's items """
        pass

def keys(self): # real signature unknown; restored from \_\_doc\_\_
"""
所有的key 列表
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
a = user\_info.keys()
print(a)
"""
        """ 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\_\_
"""
获取并在字典中移除
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
user\_info.pop('age')
print(user\_info)
"""
        """
        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\_\_
""" 
随机并在字典中移除
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
user\_info.popitem()
user\_info.popitem()
print(user\_info)
"""
        """
        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\_\_
""" 
如果key不存在,则创建,如果存在,则返回已存在的值且不修改 
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
a = user\_info.setdefault("age")
print(a)
user\_info.setdefault("cool")
print(user\_info)
"""
        """ 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
""" 
更新(两个字典)
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
user\_info2 = {
    "wage":800000000,
    "drem":"The knife girl"
}
user\_info.update(user\_info2)
print(user\_info)
"""
        """
        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\_\_
"""
所有的值,values
user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
a = user\_info.values()
print(a)
"""
        """ 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

dict

7、set集合(无序、不重复)

s = set()  
a = {'nick','jenny','suo'}
#添加元素
a = {'nick','jenny','suo'}
a.add('The knife girl')
print(a)

#更新
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
a.update(b)
print(a)


#a中存在。b中不存在,赋给新值
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
set = a.difference(b)
print(set)

#a中存在。b中不存在,并更新a
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
a.difference\_update(b)
print(a)

#交集,赋给新值
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
set = a.intersection(b)
print(set)

#交集,更新a
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
a.intersection\_update(b)
print(a)

#对称交集
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
set = a.symmetric\_difference(b)
print(set)

#对称交集,更新a
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
a.symmetric\_difference\_update(b)
print(a)

#并集,赋给新值
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
set = a.union(b)
print(set)

#如果没有交集,返回True,否则返回False
a = {'nick','jenny','suo'}
b = {'nick','jenny','The knife girl'}
set = a.isdisjoint(b)
print(set)

#是否是子序列
a = {'nick','jenny','suo'}
b = {'nick','jenny'}
set = a.issubset(b)
print(set)

#是否是父序列
a = {'nick','jenny','suo'}
b = {'nick','jenny'}
set = a.issuperset(b)
print(set)


#移除指定元素,不存在不报错
a = {'nick','jenny','suo'}
a.discard('suo')
print(a)

#移除指定元素,不存在则报错
a = {'nick','jenny','suo'}
a.remove('suo')
print(a)
a.remove('suo')
print(a)

#移除随机元素,并赋给新值
a = {'nick','jenny','suo'}
set = a.pop()
print(set)

#清空
a = {'nick','jenny','suo'}
a.clear()
print(a)

class set(object):
    """
    set() -> new empty set object
    set(iterable) -> new set object
    
    Build an unordered collection of unique elements.
    """
def add(self, \*args, \*\*kwargs): # real signature unknown
"""添加元素
>>> a = {'nick','jenny','suo'}
>>> a.add('nick')
>>> a
{'suo', 'jenny', 'nick'}
>>> a.add('love')
>>> a
{'suo', 'love', 'jenny', 'nick'}
"""
        """
        Add an element to a set.
        
        This has no effect if the element is already present.
        """
        pass

def clear(self, \*args, \*\*kwargs): # real signature unknown
"""清除内容
>>> a = {'nick','jenny','suo'}
>>> a.clear()
>>> a
set()
"""
        """ Remove all elements from this set. """
        pass

def copy(self, \*args, \*\*kwargs): # real signature unknown
"""浅拷贝
>>> a = {'nick','jenny','suo'}
>>> b = a.copy()
>>> b
{'suo', 'jenny', 'nick'}
"""
        """ Return a shallow copy of a set. """
        pass

def difference(self, \*args, \*\*kwargs): # real signature unknown
"""A中存在,B中不存在
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.difference(b)
{'suo'}
"""
        """
        Return the difference of two or more sets as a new set.
        
        (i.e. all elements that are in this set but not the others.)
        """
        pass

def difference\_update(self, \*args, \*\*kwargs): # real signature unknown
"""从当前集合中删除和B中相同的元素
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.difference\_update(b)
>>> a
{'suo'}
"""
        """ Remove all elements of another set from this set. """
        pass

def discard(self, \*args, \*\*kwargs): # real signature unknown
"""移除指定元素,不存在不报错
>>> a = {'nick','jenny','suo'}
>>> a.discard('suo')
>>> a
{'jenny', 'nick'}
>>> a.discard('The knife girl')
>>> a
{'jenny', 'nick'}
"""
        """
        Remove an element from a set if it is a member.
        
        If the element is not a member, do nothing.
        """
        pass

def intersection(self, \*args, \*\*kwargs): # real signature unknown
"""a与b的交集
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.intersection(b)
{'jenny', 'nick'}
"""
        """
        Return the intersection of two sets as a new set.
        
        (i.e. all elements that are in both sets.)
        """
        pass

def intersection\_update(self, \*args, \*\*kwargs): # real signature unknown
"""取交集并更更新到A中
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.intersection\_update(b)
>>> a
{'jenny', 'nick'}
"""
        """ Update a set with the intersection of itself and another. """
        pass

def isdisjoint(self, \*args, \*\*kwargs): # real signature unknown
"""如果没有交集,返回True,否则返回False
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.isdisjoint(b)
False
"""
        """ Return True if two sets have a null intersection. """
        pass

def issubset(self, \*args, \*\*kwargs): # real signature unknown
"""是否是子序列
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny'}
>>> b.issubset(a)
True
>>> a.issubset(b)
False
"""
        """ Report whether another set contains this set. """
        pass

def issuperset(self, \*args, \*\*kwargs): # real signature unknown
"""是否是父序列
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny'}
>>> a.issuperset(b)
True
>>> b.issuperset(a)
False
"""
        """ Report whether this set contains another set. """
        pass

def pop(self, \*args, \*\*kwargs): # real signature unknown
"""移除元素
>>> a = {'nick','jenny','suo'}
>>> a.pop()
'suo'
>>> a
{'jenny', 'nick'}
"""
        """
        Remove and return an arbitrary set element.
        Raises KeyError if the set is empty.
        """
        pass

def remove(self, \*args, \*\*kwargs): # real signature unknown
"""移除指定元素,不存在报错
>>> a = {'nick','jenny','suo'}
>>> a.remove('nick')
>>> a
{'suo', 'jenny'}
>>> a.remove('The knife girl')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'The knife girl'
>>> 
"""
        """
        Remove an element from a set; it must be a member.
        
        If the element is not a member, raise a KeyError.
        """
        pass

def symmetric\_difference(self, \*args, \*\*kwargs): # real signature unknown
"""对称交集
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.symmetric\_difference(b)
{'suo', 'The knife girl'}
"""
        """
        Return the symmetric difference of two sets as a new set.
        
        (i.e. all elements that are in exactly one of the sets.)
        """
        pass

def symmetric\_difference\_update(self, \*args, \*\*kwargs): # real signature unknown
"""对称交集,并更新到a中
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.symmetric\_difference\_update(b)
>>> a
{'suo', 'The knife girl'}
"""
        """ Update a set with the symmetric difference of itself and another. """
        pass

def union(self, \*args, \*\*kwargs): # real signature unknown
"""并集
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.union(b)
{'suo', 'jenny', 'nick', 'The knife girl'}
"""
        """
        Return the union of sets as a new set.
        
        (i.e. all elements that are in either set.)
        """
        pass

def update(self, \*args, \*\*kwargs): # real signature unknown
"""更新
>>> a = {'nick','jenny','suo'}
>>> b = {'nick','jenny','The knife girl'}
>>> a.update(b)
>>> a
{'suo', 'jenny', 'nick', 'The knife girl'}
>>> b
{'jenny', 'nick', 'The knife girl'}
"""
        """ Update a set with the union of itself and others. """
        pass

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

    def \_\_contains\_\_(self, y): # real signature unknown; restored from \_\_doc\_\_
        """ x.\_\_contains\_\_(y) <==> y in x. """
        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 \_\_ge\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self>=value. """
        pass

    def \_\_gt\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self>value. """
        pass

    def \_\_iand\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self&=value. """
        pass

    def \_\_init\_\_(self, seq=()): # known special case of set.\_\_init\_\_
        """
        set() -> new empty set object
        set(iterable) -> new set object
        
        Build an unordered collection of unique elements.
        # (copied from class doc)
        """
        pass

    def \_\_ior\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self|=value. """
        pass

    def \_\_isub\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self-=value. """
        pass

    def \_\_iter\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Implement iter(self). """
        pass

    def \_\_ixor\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self^=value. """
        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 \_\_or\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return self|value. """
        pass

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

    def \_\_reduce\_\_(self, \*args, \*\*kwargs): # real signature unknown
        """ Return state information for pickling. """
        pass

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

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

    def \_\_rsub\_\_(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): # real signature unknown; restored from \_\_doc\_\_
        """ S.\_\_sizeof\_\_() -> size of S in memory, in bytes """
        pass

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

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

    \_\_hash\_\_ = None

set

frozenset

是冻结的集合,它是不可变的,存在哈希值,好处是它可以作为字典的key,也可以作为其它集合的元素。缺点是一旦创建便不能更改,没有add,remove方法。

\>>> name = frozenset({"suoning"})
\>>> name
frozenset({'suoning'})
\>>>

其他

1、for循环

用户按照顺序循环可迭代对象中的内容

name = ('nick','jenney')
for i in name:
    print(i)

2、enumrate

为可迭代的对象添加序号

user\_info = {
    "name":"nick",
    "age":18,
    "job":"pythoner"
}
for k,v in enumerate(user\_info,1):
    print(k,v,user\_info.get(v))

3、range和xrange

指定范围,生成指定的数字

#python 2.7 版本
print range(1, 10)
# 结果:\[1, 2, 3, 4, 5, 6, 7, 8, 9\]
 
print range(1, 10, 2)
# 结果:\[1, 3, 5, 7, 9\]
 
print range(30, 0, -2)
# 结果:\[30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2\]


#python 3.5 版本
a = range(10)
print(a)
#结果:range(0, 10)

4、编码与进制转换

  • utf-8与gbk编码转换

  • 进制的转换

  • 把自己名字用进制表示出来
name = "索宁"

a = bytes(name,encoding='utf-8')
print(a)
for i in a:
    print(i,bin(i))

#输出结果(utf-8 三个字节表示一个汉字)
b'\\xe7\\xb4\\xa2\\xe5\\xae\\x81'
231 0b11100111
180 0b10110100
162 0b10100010
229 0b11100101
174 0b10101110
129 0b10000001


b = bytes(name,encoding='gbk')
print(b)
for i in b:
    print(i,bin(i))

#输出结果(gbk 两个字节表示一个汉字)
b'\\xcb\\xf7\\xc4\\xfe'
203 0b11001011
247 0b11110111
196 0b11000100
254 0b11111110

完整版的Python全套学习资料扫码免费领取!

学好 Python 不论是就业还是做副业赚钱都不错,但要学会 Python 还是要有一个学习规划。最后大家分享一份全套的 Python 学习资料,给那些想学习 Python 的小伙伴们一点帮助!

一、Python所有方向的学习路线

Python所有方向路线就是把Python常用的技术点做整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。

二、学习软件

工欲善其事必先利其器。学习Python常用的开发软件都在这里了,给大家节省了很多时间。

三、入门学习视频

我们在看视频学习的时候,不能光动眼动脑不动手,比较科学的学习方法是在理解之后运用它们,这时候练手项目就很适合了。

四、实战案例

光学理论是没用的,要学会跟着一起敲,要动手实操,才能将自己的所学运用到实际当中去,这时候可以搞点实战案例来学习。

五、面试资料

我们学习Python必然是为了找到高薪的工作,下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料,并且有阿里大佬给出了权威的解答,刷完这一套面试资料相信大家都能找到满意的工作。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值