Python【02】【基础部分】- B

1、作用域

变量只要在内存存在,就可以被使用 。(栈)

1 if 1 == 1:
2     name = 'kim'
3 print name

个例:item的值为字典循环后最后一个key的值

1 name = {'xiaoming':12,'xiaohua':15,'xiaoli':11}
2 for item in name:
3     print item
4 xiaoli

2、三元运算

name = 值

name = 值1  if  条件 else 值2

1 user_input = raw_input(':')
2 name  = 'badman' if user_input == 'alex' else 'goodman'
3 print name

3、类与对象

对于python,一切事物皆是对象,对象是基于类创建的。

类里面保存了对象所需要的功能

查看类功能:

1 >>> name = 'hope' 
2 >>> type(name)            # 查看数据类型
3 <type 'str'>
4 >>> dir(name)             # 查看name的可用功能
5 ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
6 >>> help(name.join)       # 查看具体功能的使用帮助

类中的方法:

私有方法,可以有多种执行方法,至少一种。'__class__'

非私有方法,只有一种执行方法,对象.方法   'count'

4、整形

  1 class int(object):
  2     """
  3     int(x=0) -> int or long
  4     int(x, base=10) -> int or long    # base=要转换的进制数
  5     
  6     Convert a number or string to an integer, or return 0 if no arguments
  7     are given.  If x is floating point, the conversion truncates towards zero.
  8     If x is outside the integer range, the function returns a long instead.
  9     
 10     If x is not a number or if base is given, then x must be a string or
 11     Unicode object representing an integer literal in the given base.  The
 12     literal can be preceded by '+' or '-' and be surrounded by whitespace.
 13     The base defaults to 10.  Valid bases are 0 and 2-36.  Base 0 means to
 14     interpret the base from the string as an integer literal.
 15     >>> int('0b100', base=0)
 16     4
 17     """
 18     def bit_length(self): # real signature unknown; restored from __doc__
 19         """
 20         int.bit_length() -> int  
 21   
 22         """ 
 23         >>> int.bit_length(12)
 24         4
 25         # 表示当前数值在二进制位中所占的位
 26         """
 27 
 28         Number of bits necessary to represent self in binary.
 29         >>> bin(37)
 30         '0b100101'
 31         >>> (37).bit_length()
 32         6
 33         """
 34         return 0
 35     def conjugate(self, *args, **kwargs): # real signature unknown
 36         """ Returns self, the complex conjugate of any int. """
 37         """返回该复数的共轭复数"""
 38         pass
 39     def __abs__(self): # real signature unknown; restored from __doc__
 40         """ x.__abs__() <==> abs(x) """
 41         """
 42         # 返回绝对值
 43         >>> abs(-12)
 44         12
 45         """
 46         pass
 47     def __add__(self, y): # real signature unknown; restored from __doc__
 48         """ x.__add__(y) <==> x+y """    # 加运算
 49         pass
 50     def __and__(self, y): # real signature unknown; restored from __doc__
 51         """ x.__and__(y) <==> x&y """    # 与运算
 52         pass
 53     def __cmp__(self, y): # real signature unknown; restored from __doc__
 54         """ x.__cmp__(y) <==> cmp(x,y) """    # 比较大小
 55         pass
 56     def __coerce__(self, y): # real signature unknown; restored from __doc__
 57         """ x.__coerce__(y) <==> coerce(x, y) """    # 强制生成一个元组
 58         pass
 59     def __divmod__(self, y): # real signature unknown; restored from __doc__
 60         """ x.__divmod__(y) <==> divmod(x, y) """    # 两数相除,商与余数组成一个元组
 61         pass
 62     def __div__(self, y): # real signature unknown; restored from __doc__
 63         """ x.__div__(y) <==> x/y """                # 两数相除
 64         pass
 65     def __float__(self): # real signature unknown; restored from __doc__
 66         """ x.__float__() <==> float(x) """          # 符点数转转换
 67         pass
 68     def __floordiv__(self, y): # real signature unknown; restored from __doc__
 69         """ x.__floordiv__(y) <==> x//y """          # 取整除,返回商的整数部分
 70         pass
 71     def __format__(self, *args, **kwargs): # real signature unknown
 72         pass
 73     def __getattribute__(self, name): # real signature unknown; restored from __doc__
 74         """ x.__getattribute__('name') <==> x.name """    # 
 75         pass
 76     def __getnewargs__(self, *args, **kwargs): # real signature unknown
 77         pass
 78        """ 内部调用 __new__方法或创建对象时传入参数使用 """ 
 79     def __hash__(self): # real signature unknown; restored from __doc__
 80         """ x.__hash__() <==> hash(x) """
 81          """如果对象object为哈希表类型,返回对象object的哈希值。哈希值为整数。在字典查找中,哈希值用于快速比较字典的键。两个数值如果相等,则哈希值也相等。"""
 82         pass
 83     def __hex__(self): # real signature unknown; restored from __doc__
 84        """ 返回当前值的 十六进制 表示 """
 85         """ x.__hex__() <==> hex(x) """
 86         pass
 87     def __index__(self): # real signature unknown; restored from __doc__
 88        """ 用于切片,数字无意义 """
 89         """ x[y:z] <==> x[y.__index__():z.__index__()] """
 90         pass
 91     def __init__(self, x, base=10): # known special case of int.__init__
 92         """
 93         int(x=0) -> int or long
 94         int(x, base=10) -> int or long
 95         
 96         Convert a number or string to an integer, or return 0 if no arguments
 97         are given.  If x is floating point, the conversion truncates towards zero.
 98         If x is outside the integer range, the function returns a long instead.
 99         
100         If x is not a number or if base is given, then x must be a string or
101         Unicode object representing an integer literal in the given base.  The
102         literal can be preceded by '+' or '-' and be surrounded by whitespace.
103         The base defaults to 10.  Valid bases are 0 and 2-36.  Base 0 means to
104         interpret the base from the string as an integer literal.
105         >>> int('0b100', base=0)
106         4
107         # (copied from class doc)
108         """
109         pass
110     def __int__(self): # real signature unknown; restored from __doc__
111         """ x.__int__() <==> int(x) """    # 转换为整型
112         pass
113     def __invert__(self): # real signature unknown; restored from __doc__
114         """ x.__invert__() <==> ~x """    # 倒置值
115         pass
116     def __long__(self): # real signature unknown; restored from __doc__
117         """ x.__long__() <==> long(x) """    # 长整型
118         pass
119     def __lshift__(self, y): # real signature unknown; restored from __doc__
120         """ x.__lshift__(y) <==> x<<y """    # 向左位移
121         pass
122     def __mod__(self, y): # real signature unknown; restored from __doc__
123         """ x.__mod__(y) <==> x%y """        # 取模,取除法的余数
124         pass
125     def __mul__(self, y): # real signature unknown; restored from __doc__
126         """ x.__mul__(y) <==> x*y """        # 取幂
127         pass
128     def __neg__(self): # real signature unknown; restored from __doc__
129         """ x.__neg__() <==> -x """         #取负数
130         pass
131     @staticmethod # known case of __new__
132     def __new__(S, *more): # real signature unknown; restored from __doc__
133         """ T.__new__(S, ...) -> a new object with type S, a subtype of T """
134         pass
135     def __nonzero__(self): # real signature unknown; restored from __doc__
136         """ x.__nonzero__() <==> x != 0 """        # 非 0
137         pass
138     def __oct__(self): # real signature unknown; restored from __doc__
139         """ x.__oct__() <==> oct(x) """            # 返回当前值的 二六进制 表
140         pass
141     def __or__(self, y): # real signature unknown; restored from __doc__
142         """ x.__or__(y) <==> x|y """            #  或运算
143         pass
144     def __pos__(self): # real signature unknown; restored from __doc__
145         """ x.__pos__() <==> +x """            # 加运算
146         pass
147     def __pow__(self, y, z=None): # real signature unknown; restored from __doc__
148         """ x.__pow__(y[, z]) <==> pow(x, y[, z]) """       # 取次幂
149         pass
150     def __radd__(self, y): # real signature unknown; restored from __doc__
151         """ x.__radd__(y) <==> y+x """
152         pass
153     def __rand__(self, y): # real signature unknown; restored from __doc__
154         """ x.__rand__(y) <==> y&x """
155         pass
156     def __rdivmod__(self, y): # real signature unknown; restored from __doc__
157         """ x.__rdivmod__(y) <==> divmod(y, x) """
158         pass
159     def __rdiv__(self, y): # real signature unknown; restored from __doc__
160         """ x.__rdiv__(y) <==> y/x """
161         pass
162     def __repr__(self): # real signature unknown; restored from __doc__
163         """ x.__repr__() <==> repr(x) """
164        """转化为解释器可读取的形式 """
165         pass
166     def __rfloordiv__(self, y): # real signature unknown; restored from __doc__
167         """ x.__rfloordiv__(y) <==> y//x """
168         pass
169     def __rlshift__(self, y): # real signature unknown; restored from __doc__
170         """ x.__rlshift__(y) <==> y<<x """
171         pass
172     def __rmod__(self, y): # real signature unknown; restored from __doc__
173         """ x.__rmod__(y) <==> y%x """
174         pass
175     def __rmul__(self, y): # real signature unknown; restored from __doc__
176         """ x.__rmul__(y) <==> y*x """
177         pass
178     def __ror__(self, y): # real signature unknown; restored from __doc__
179         """ x.__ror__(y) <==> y|x """
180         pass
181     def __rpow__(self, x, z=None): # real signature unknown; restored from __doc__
182         """ y.__rpow__(x[, z]) <==> pow(x, y[, z]) """
183         pass
184     def __rrshift__(self, y): # real signature unknown; restored from __doc__
185         """ x.__rrshift__(y) <==> y>>x """
186         pass
187     def __rshift__(self, y): # real signature unknown; restored from __doc__
188         """ x.__rshift__(y) <==> x>>y """
189         pass
190     def __rsub__(self, y): # real signature unknown; restored from __doc__
191         """ x.__rsub__(y) <==> y-x """
192         pass
193     def __rtruediv__(self, y): # real signature unknown; restored from __doc__
194         """ x.__rtruediv__(y) <==> y/x """
195         pass
196     def __rxor__(self, y): # real signature unknown; restored from __doc__
197         """ x.__rxor__(y) <==> y^x """
198         pass
199     def __str__(self): # real signature unknown; restored from __doc__
200         """转换为人阅读的形式,如果没有适于人阅读的解释形式的话,则返回解释器课阅读的形式"""
201         """ x.__str__() <==> str(x) """
202         pass
203     def __sub__(self, y): # real signature unknown; restored from __doc__
204         """ x.__sub__(y) <==> x-y """
205         pass
206     def __truediv__(self, y): # real signature unknown; restored from __doc__
207         """ x.__truediv__(y) <==> x/y """
208         pass
209     def __trunc__(self, *args, **kwargs): # real signature unknown
210         """ Truncating an Integral returns itself. """
211         pass
212     def __xor__(self, y): # real signature unknown; restored from __doc__
213         """ x.__xor__(y) <==> x^y """
214         pass
215     denominator = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
216     """the denominator of a rational number in lowest terms"""
217     """ 分母 = 1 """
218     imag = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
219     """the imaginary part of a complex number"""
220     """ 虚数,无意义 """
221     numerator = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
222     """the numerator of a rational number in lowest terms"""
223     """ 分子 = 数字大小 """
224       
225     real = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
226     """the real part of a complex number"""
227     """ 实属,无意义 """
int 

5、长整形

  1 class long(object):
  2     """
  3     long(x=0) -> long
  4     long(x, base=10) -> long
  5     
  6     Convert a number or string to a long integer, or return 0L if no arguments
  7     are given.  If x is floating point, the conversion truncates towards zero.
  8     
  9     If x is not a number or if base is given, then x must be a string or
 10     Unicode object representing an integer literal in the given base.  The
 11     literal can be preceded by '+' or '-' and be surrounded by whitespace.
 12     The base defaults to 10.  Valid bases are 0 and 2-36.  Base 0 means to
 13     interpret the base from the string as an integer literal.
 14     >>> int('0b100', base=0)
 15     4L
 16     """
 17     def bit_length(self): # real signature unknown; restored from __doc__
 18         """
 19         long.bit_length() -> int or long
 20         
 21         Number of bits necessary to represent self in binary.
 22         >>> bin(37L)
 23         '0b100101'
 24         >>> (37L).bit_length()
 25         6
 26         """
 27         return 0
 28 
 29     def conjugate(self, *args, **kwargs): # real signature unknown
 30         """ Returns self, the complex conjugate of any long. """
 31         pass
 32 
 33     def __abs__(self): # real signature unknown; restored from __doc__
 34         """ x.__abs__() <==> abs(x) """
 35         pass
 36 
 37     def __add__(self, y): # real signature unknown; restored from __doc__
 38         """ x.__add__(y) <==> x+y """
 39         pass
 40 
 41     def __and__(self, y): # real signature unknown; restored from __doc__
 42         """ x.__and__(y) <==> x&y """
 43         pass
 44 
 45     def __cmp__(self, y): # real signature unknown; restored from __doc__
 46         """ x.__cmp__(y) <==> cmp(x,y) """
 47         pass
 48 
 49     def __coerce__(self, y): # real signature unknown; restored from __doc__
 50         """ x.__coerce__(y) <==> coerce(x, y) """
 51         pass
 52 
 53     def __divmod__(self, y): # real signature unknown; restored from __doc__
 54         """ x.__divmod__(y) <==> divmod(x, y) """
 55         pass
 56 
 57     def __div__(self, y): # real signature unknown; restored from __doc__
 58         """ x.__div__(y) <==> x/y """
 59         pass
 60 
 61     def __float__(self): # real signature unknown; restored from __doc__
 62         """ x.__float__() <==> float(x) """
 63         pass
 64 
 65     def __floordiv__(self, y): # real signature unknown; restored from __doc__
 66         """ x.__floordiv__(y) <==> x//y """
 67         pass
 68 
 69     def __format__(self, *args, **kwargs): # real signature unknown
 70         pass
 71 
 72     def __getattribute__(self, name): # real signature unknown; restored from __doc__
 73         """ x.__getattribute__('name') <==> x.name """
 74         pass
 75 
 76     def __getnewargs__(self, *args, **kwargs): # real signature unknown
 77         pass
 78 
 79     def __hash__(self): # real signature unknown; restored from __doc__
 80         """ x.__hash__() <==> hash(x) """
 81         pass
 82 
 83     def __hex__(self): # real signature unknown; restored from __doc__
 84         """ x.__hex__() <==> hex(x) """
 85         pass
 86 
 87     def __index__(self): # real signature unknown; restored from __doc__
 88         """ x[y:z] <==> x[y.__index__():z.__index__()] """
 89         pass
 90 
 91     def __init__(self, x=0): # real signature unknown; restored from __doc__
 92         pass
 93 
 94     def __int__(self): # real signature unknown; restored from __doc__
 95         """ x.__int__() <==> int(x) """
 96         pass
 97 
 98     def __invert__(self): # real signature unknown; restored from __doc__
 99         """ x.__invert__() <==> ~x """
100         pass
101 
102     def __long__(self): # real signature unknown; restored from __doc__
103         """ x.__long__() <==> long(x) """
104         pass
105 
106     def __lshift__(self, y): # real signature unknown; restored from __doc__
107         """ x.__lshift__(y) <==> x<<y """
108         pass
109 
110     def __mod__(self, y): # real signature unknown; restored from __doc__
111         """ x.__mod__(y) <==> x%y """
112         pass
113 
114     def __mul__(self, y): # real signature unknown; restored from __doc__
115         """ x.__mul__(y) <==> x*y """
116         pass
117 
118     def __neg__(self): # real signature unknown; restored from __doc__
119         """ x.__neg__() <==> -x """
120         pass
121 
122     @staticmethod # known case of __new__
123     def __new__(S, *more): # real signature unknown; restored from __doc__
124         """ T.__new__(S, ...) -> a new object with type S, a subtype of T """
125         pass
126 
127     def __nonzero__(self): # real signature unknown; restored from __doc__
128         """ x.__nonzero__() <==> x != 0 """
129         pass
130 
131     def __oct__(self): # real signature unknown; restored from __doc__
132         """ x.__oct__() <==> oct(x) """
133         pass
134 
135     def __or__(self, y): # real signature unknown; restored from __doc__
136         """ x.__or__(y) <==> x|y """
137         pass
138 
139     def __pos__(self): # real signature unknown; restored from __doc__
140         """ x.__pos__() <==> +x """
141         pass
142 
143     def __pow__(self, y, z=None): # real signature unknown; restored from __doc__
144         """ x.__pow__(y[, z]) <==> pow(x, y[, z]) """
145         pass
146 
147     def __radd__(self, y): # real signature unknown; restored from __doc__
148         """ x.__radd__(y) <==> y+x """
149         pass
150 
151     def __rand__(self, y): # real signature unknown; restored from __doc__
152         """ x.__rand__(y) <==> y&x """
153         pass
154 
155     def __rdivmod__(self, y): # real signature unknown; restored from __doc__
156         """ x.__rdivmod__(y) <==> divmod(y, x) """
157         pass
158 
159     def __rdiv__(self, y): # real signature unknown; restored from __doc__
160         """ x.__rdiv__(y) <==> y/x """
161         pass
162 
163     def __repr__(self): # real signature unknown; restored from __doc__
164         """ x.__repr__() <==> repr(x) """
165         pass
166 
167     def __rfloordiv__(self, y): # real signature unknown; restored from __doc__
168         """ x.__rfloordiv__(y) <==> y//x """
169         pass
170 
171     def __rlshift__(self, y): # real signature unknown; restored from __doc__
172         """ x.__rlshift__(y) <==> y<<x """
173         pass
174 
175     def __rmod__(self, y): # real signature unknown; restored from __doc__
176         """ x.__rmod__(y) <==> y%x """
177         pass
178 
179     def __rmul__(self, y): # real signature unknown; restored from __doc__
180         """ x.__rmul__(y) <==> y*x """
181         pass
182 
183     def __ror__(self, y): # real signature unknown; restored from __doc__
184         """ x.__ror__(y) <==> y|x """
185         pass
186 
187     def __rpow__(self, x, z=None): # real signature unknown; restored from __doc__
188         """ y.__rpow__(x[, z]) <==> pow(x, y[, z]) """
189         pass
190 
191     def __rrshift__(self, y): # real signature unknown; restored from __doc__
192         """ x.__rrshift__(y) <==> y>>x """
193         pass
194 
195     def __rshift__(self, y): # real signature unknown; restored from __doc__
196         """ x.__rshift__(y) <==> x>>y """
197         pass
198 
199     def __rsub__(self, y): # real signature unknown; restored from __doc__
200         """ x.__rsub__(y) <==> y-x """
201         pass
202 
203     def __rtruediv__(self, y): # real signature unknown; restored from __doc__
204         """ x.__rtruediv__(y) <==> y/x """
205         pass
206 
207     def __rxor__(self, y): # real signature unknown; restored from __doc__
208         """ x.__rxor__(y) <==> y^x """
209         pass
210 
211     def __sizeof__(self, *args, **kwargs): # real signature unknown
212         """ Returns size in memory, in bytes """
213         pass
214 
215     def __str__(self): # real signature unknown; restored from __doc__
216         """ x.__str__() <==> str(x) """
217         pass
218 
219     def __sub__(self, y): # real signature unknown; restored from __doc__
220         """ x.__sub__(y) <==> x-y """
221         pass
222 
223     def __truediv__(self, y): # real signature unknown; restored from __doc__
224         """ x.__truediv__(y) <==> x/y """
225         pass
226 
227     def __trunc__(self, *args, **kwargs): # real signature unknown
228         """ Truncating an Integral returns itself. """
229         pass
230 
231     def __xor__(self, y): # real signature unknown; restored from __doc__
232         """ x.__xor__(y) <==> x^y """
233         pass
234 
235     denominator = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
236     """the denominator of a rational number in lowest terms"""
237 
238     imag = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
239     """the imaginary part of a complex number"""
240 
241     numerator = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
242     """the numerator of a rational number in lowest terms"""
243 
244     real = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
245     """the real part of a complex number"""
long

6、符点数

  1 class float(object):
  2     """
  3     float(x) -> floating point number
  4     
  5     Convert a string or number to a floating point number, if possible.
  6     """
  7     def as_integer_ratio(self):   
  8         """ 获取改值的最简比 """
  9         """
 10         float.as_integer_ratio() -> (int, int)
 11         Return a pair of integers, whose ratio is exactly equal to the original
 12         float and with a positive denominator.
 13         Raise OverflowError on infinities and a ValueError on NaNs.
 14         >>> (10.0).as_integer_ratio()
 15         (10, 1)
 16         >>> (0.0).as_integer_ratio()
 17         (0, 1)
 18         >>> (-.25).as_integer_ratio()
 19         (-1, 4)
 20         """
 21         pass
 22     def conjugate(self, *args, **kwargs): # real signature unknown
 23         """ Return self, the complex conjugate of any float. """
 24         pass
 25     def fromhex(self, string):   
 26         """ 将十六进制字符串转换成浮点型 """
 27         """
 28         float.fromhex(string) -> float
 29         
 30         Create a floating-point number from a hexadecimal string.
 31         >>> float.fromhex('0x1.ffffp10')
 32         2047.984375
 33         >>> float.fromhex('-0x1p-1074')
 34         -4.9406564584124654e-324
 35         """
 36         return 0.0
 37     def hex(self):   
 38         """ 返回当前值的 16 进制表示 """
 39         """
 40         float.hex() -> string
 41         
 42         Return a hexadecimal representation of a floating-point number.
 43         >>> (-0.1).hex()
 44         '-0x1.999999999999ap-4'
 45         >>> 3.14159.hex()
 46         '0x1.921f9f01b866ep+1'
 47         """
 48         return ""
 49     def is_integer(self, *args, **kwargs): # real signature unknown
 50         """ Return True if the float is an integer. """
 51         pass
 52     def __abs__(self):   
 53         """ x.__abs__() <==> abs(x) """
 54         pass
 55     def __add__(self, y):   
 56         """ x.__add__(y) <==> x+y """
 57         pass
 58     def __coerce__(self, y):   
 59         """ x.__coerce__(y) <==> coerce(x, y) """
 60         pass
 61     def __divmod__(self, y):   
 62         """ x.__divmod__(y) <==> divmod(x, y) """
 63         pass
 64     def __div__(self, y):   
 65         """ x.__div__(y) <==> x/y """
 66         pass
 67     def __eq__(self, y):   
 68         """ x.__eq__(y) <==> x==y """
 69         pass
 70     def __float__(self):   
 71         """ x.__float__() <==> float(x) """
 72         pass
 73     def __floordiv__(self, y):   
 74         """ x.__floordiv__(y) <==> x//y """
 75         pass
 76     def __format__(self, format_spec):   
 77         """
 78         float.__format__(format_spec) -> string
 79         
 80         Formats the float according to format_spec.
 81         """
 82         return ""
 83     def __getattribute__(self, name):   
 84         """ x.__getattribute__('name') <==> x.name """
 85         pass
 86     def __getformat__(self, typestr):   
 87         """
 88         float.__getformat__(typestr) -> string
 89         
 90         You probably don't want to use this function.  It exists mainly to be
 91         used in Python's test suite.
 92         
 93         typestr must be 'double' or 'float'.  This function returns whichever of
 94         'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the
 95         format of floating point numbers used by the C type named by typestr.
 96         """
 97         return ""
 98     def __getnewargs__(self, *args, **kwargs): # real signature unknown
 99         pass
100     def __ge__(self, y):   
101         """ x.__ge__(y) <==> x>=y """
102         pass
103     def __gt__(self, y):   
104         """ x.__gt__(y) <==> x>y """
105         pass
106     def __hash__(self):   
107         """ x.__hash__() <==> hash(x) """
108         pass
109     def __init__(self, x):   
110         pass
111     def __int__(self):   
112         """ x.__int__() <==> int(x) """
113         pass
114     def __le__(self, y):   
115         """ x.__le__(y) <==> x<=y """
116         pass
117     def __long__(self):   
118         """ x.__long__() <==> long(x) """
119         pass
120     def __lt__(self, y):   
121         """ x.__lt__(y) <==> x<y """
122         pass
123     def __mod__(self, y):   
124         """ x.__mod__(y) <==> x%y """
125         pass
126     def __mul__(self, y):   
127         """ x.__mul__(y) <==> x*y """
128         pass
129     def __neg__(self):   
130         """ x.__neg__() <==> -x """
131         pass
132     @staticmethod # known case of __new__
133     def __new__(S, *more):   
134         """ T.__new__(S, ...) -> a new object with type S, a subtype of T """
135         pass
136     def __ne__(self, y):   
137         """ x.__ne__(y) <==> x!=y """
138         pass
139     def __nonzero__(self):   
140         """ x.__nonzero__() <==> x != 0 """
141         pass
142     def __pos__(self):   
143         """ x.__pos__() <==> +x """
144         pass
145     def __pow__(self, y, z=None):   
146         """ x.__pow__(y[, z]) <==> pow(x, y[, z]) """
147         pass
148     def __radd__(self, y):   
149         """ x.__radd__(y) <==> y+x """
150         pass
151     def __rdivmod__(self, y):   
152         """ x.__rdivmod__(y) <==> divmod(y, x) """
153         pass
154     def __rdiv__(self, y):   
155         """ x.__rdiv__(y) <==> y/x """
156         pass
157     def __repr__(self):   
158         """ x.__repr__() <==> repr(x) """
159         pass
160     def __rfloordiv__(self, y):   
161         """ x.__rfloordiv__(y) <==> y//x """
162         pass
163     def __rmod__(self, y):   
164         """ x.__rmod__(y) <==> y%x """
165         pass
166     def __rmul__(self, y):   
167         """ x.__rmul__(y) <==> y*x """
168         pass
169     def __rpow__(self, x, z=None):   
170         """ y.__rpow__(x[, z]) <==> pow(x, y[, z]) """
171         pass
172     def __rsub__(self, y):   
173         """ x.__rsub__(y) <==> y-x """
174         pass
175     def __rtruediv__(self, y):   
176         """ x.__rtruediv__(y) <==> y/x """
177         pass
178     def __setformat__(self, typestr, fmt):   
179         """
180         float.__setformat__(typestr, fmt) -> None
181         
182         You probably don't want to use this function.  It exists mainly to be
183         used in Python's test suite.
184         
185         typestr must be 'double' or 'float'.  fmt must be one of 'unknown',
186         'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be
187         one of the latter two if it appears to match the underlying C reality.
188         
189         Override the automatic determination of C-level floating point type.
190         This affects how floats are converted to and from binary strings.
191         """
192         pass
193     def __str__(self):   
194         """ x.__str__() <==> str(x) """
195         pass
196     def __sub__(self, y):   
197         """ x.__sub__(y) <==> x-y """
198         pass
199     def __truediv__(self, y):   
200         """ x.__truediv__(y) <==> x/y """
201         pass
202     def __trunc__(self, *args, **kwargs): # real signature unknown
203         """ Return the Integral closest to x between 0 and x. """
204         pass
205     imag = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
206     """the imaginary part of a complex number"""
207     real = property(lambda self: object(), lambda self, v: None, lambda self: None)  # default
208     """the real part of a complex number"""
209 float
float

7、字符串

  1 class str(basestring):
  2     """
  3     str(object='') -> string
  4     
  5     Return a nice string representation of the object.
  6     If the argument is a string, the return value is the same object.
  7     """
  8     def capitalize(self):  
  9         """ 首字母变大写 """
 10         """
 11         S.capitalize() -> string
 12         
 13         Return a copy of the string S with only its first character
 14         capitalized.
 15         """
 16         return ""
 17     def center(self, width, fillchar=None):  
 18         """ 
 19         内容居中,width:总长度;fillchar:空白处填充内容,默认无 
 20         S = 'code'
 21         print S.center(12,"*")
 22         """
 23         """
 24         S.center(width[, fillchar]) -> string
 25         
 26         Return S centered in a string of length width. Padding is
 27         done using the specified fill character (default is a space)
 28         """
 29         return ""
 30     def count(self, sub, start=None, end=None):  
 31         """ 子序列个数 """
 32         """
 33         S.count(sub[, start[, end]]) -> int
 34         
 35         Return the number of non-overlapping occurrences of substring sub in
 36         string S[start:end].  Optional arguments start and end are interpreted
 37         as in slice notation.
 38         """
 39         return 0
 40     def decode(self, encoding=None, errors=None):  
 41         """ 解码,默认转为Unicode """
 42         """
 43         S.decode([encoding[,errors]]) -> object
 44         
 45         Decodes S using the codec registered for encoding. encoding defaults
 46         to the default encoding. errors may be given to set a different error
 47         handling scheme. Default is 'strict' meaning that encoding errors raise
 48         a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
 49         as well as any other name registered with codecs.register_error that is
 50         able to handle UnicodeDecodeErrors.
 51         """
 52         return object()
 53     def encode(self, encoding=None, errors=None):  
 54         """ 编码,针对unicode """
 55         """
 56         S.encode([encoding[,errors]]) -> object
 57         
 58         Encodes S using the codec registered for encoding. encoding defaults
 59         to the default encoding. errors may be given to set a different error
 60         handling scheme. Default is 'strict' meaning that encoding errors raise
 61         a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and
 62         'xmlcharrefreplace' as well as any other name registered with
 63         codecs.register_error that is able to handle UnicodeEncodeErrors.
 64         """
 65         return object()
 66     def endswith(self, suffix, start=None, end=None):  
 67         """ 是否以 xxx 结束 """
 68         """
 69         S.endswith(suffix[, start[, end]]) -> bool
 70         
 71         Return True if S ends with the specified suffix, False otherwise.
 72         With optional start, test S beginning at that position.
 73         With optional end, stop comparing S at that position.
 74         suffix can also be a tuple of strings to try.
 75         """
 76         return False
 77     def expandtabs(self, tabsize=None):  
 78         """ 将tab转换成空格,默认一个tab转换成8个空格 """
 79         """
 80         S.expandtabs([tabsize]) -> string
 81         
 82         Return a copy of S where all tab characters are expanded using spaces.
 83         If tabsize is not given, a tab size of 8 characters is assumed.
 84         """
 85         return ""
 86     def find(self, sub, start=None, end=None):  
 87         """ 寻找子序列位置,如果没找到,则异常(-1) """
 88         """
 89         S.find(sub [,start [,end]]) -> int
 90         
 91         Return the lowest index in S where substring sub is found,
 92         such that sub is contained within S[start:end].  Optional
 93         arguments start and end are interpreted as in slice notation.
 94         
 95         Return -1 on failure.
 96         """
 97         return 0
 98     def format(*args, **kwargs): # known special case of str.format
 99         """ 字符串格式化,动态参数,将函数式编程时细说 """
100         """
101         S.format(*args, **kwargs) -> string
102         
103         Return a formatted version of S, using substitutions from args and kwargs.
104         The substitutions are identified by braces ('{' and '}').
105         """
106         pass
107     def index(self, sub, start=None, end=None):  
108         """ 子序列位置,如果没找到 """
109         S.index(sub [,start [,end]]) -> int
110         
111         Like S.find() but raise ValueError when the substring is not found.
112         """
113         return 0
114     def isalnum(self):  
115         """ 是否是字母或数字"""
116         """
117         S.isalnum() -> bool
118         
119         Return True if all characters in S are alphanumeric
120         and there is at least one character in S, False otherwise.
121         """
122         return False
123     def isalpha(self):  
124         """ 是不中是字母 """
125         """
126         S.isalpha() -> bool
127         
128         Return True if all characters in S are alphabetic
129         and there is at least one character in S, False otherwise.
130         """
131         return False
132     def isdigit(self):  
133         """ 是否是数字 """
134         """
135         S.isdigit() -> bool
136         
137         Return True if all characters in S are digits
138         and there is at least one character in S, False otherwise.
139         """
140         return False
141     def islower(self):  
142         """ 是否是小写 """
143         """
144         S.islower() -> bool
145         
146         Return True if all cased characters in S are lowercase and there is
147         at least one cased character in S, False otherwise.
148         """
149         return False
150     def isspace(self):  
151         """
152         S.isspace() -> bool
153         
154         Return True if all characters in S are whitespace
155         and there is at least one character in S, False otherwise.
156         """
157         return False
158     def istitle(self):
159         """ 是否是标题 """  
160         """
161         S.istitle() -> bool
162         
163         Return True if S is a titlecased string and there is at least one
164         character in S, i.e. uppercase characters may only follow uncased
165         characters and lowercase characters only cased ones. Return False
166         otherwise.
167         """
168         return False
169     def isupper(self):
170         """ 是否是大写 """  
171         """
172         S.isupper() -> bool
173         
174         Return True if all cased characters in S are uppercase and there is
175         at least one cased character in S, False otherwise.
176         """
177         return False
178     def join(self, iterable):  
179         """ 连接 '_'.join(S) """
180         """
181         S.join(iterable) -> string
182         
183         Return a string which is the concatenation of the strings in the
184         iterable.  The separator between elements is S.
185         """
186         return ""
187     def ljust(self, width, fillchar=None):  
188         """ 内容在左,右侧填充 """
189         """
190         S.ljust(width[, fillchar]) -> string
191         
192         Return S left-justified in a string of length width. Padding is
193         done using the specified fill character (default is a space).
194         """
195         return ""
196     def lower(self):  
197         """ 转换为小写 """
198         """
199         S.lower() -> string
200         
201         Return a copy of the string S converted to lowercase.
202         """
203         return ""
204     def lstrip(self, chars=None):  
205         """ 移除左侧空白 """
206         """
207         S.lstrip([chars]) -> string or unicode
208         
209         Return a copy of the string S with leading whitespace removed.
210         If chars is given and not None, remove characters in chars instead.
211         If chars is unicode, S will be converted to unicode before stripping
212         """
213         return ""
214     def partition(self, sep):  
215         """ 分割前、中、后三部分 """
216         """
217         S.partition(sep) -> (head, sep, tail)
218         
219         Search for the separator sep in S, and return the part before it,
220         the separator itself, and the part after it.  If the separator is not
221         found, return S and two empty strings.
222         """
223         pass
224     def replace(self, old, new, count=None):  
225         """ 替换 """
226         """
227         S.replace(old, new[, count]) -> string
228         
229         Return a copy of string S with all occurrences of substring
230         old replaced by new.  If the optional argument count is
231         given, only the first count occurrences are replaced.
232         """
233         return ""
234     def rfind(self, sub, start=None, end=None):  
235         """
236         S.rfind(sub [,start [,end]]) -> int
237         
238         Return the highest index in S where substring sub is found,
239         such that sub is contained within S[start:end].  Optional
240         arguments start and end are interpreted as in slice notation.
241         
242         Return -1 on failure.
243         """
244         return 0
245     def rindex(self, sub, start=None, end=None):  
246         """
247         S.rindex(sub [,start [,end]]) -> int
248         
249         Like S.rfind() but raise ValueError when the substring is not found.
250         """
251         return 0
252     def rjust(self, width, fillchar=None):  
253         """
254         S.rjust(width[, fillchar]) -> string
255         
256         Return S right-justified in a string of length width. Padding is
257         done using the specified fill character (default is a space)
258         """
259         return ""
260     def rpartition(self, sep):  
261         """
262         S.rpartition(sep) -> (head, sep, tail)
263         
264         Search for the separator sep in S, starting at the end of S, and return
265         the part before it, the separator itself, and the part after it.  If the
266         separator is not found, return two empty strings and S.
267         """
268         pass
269     def rsplit(self, sep=None, maxsplit=None):  
270         """
271         S.rsplit([sep [,maxsplit]]) -> list of strings
272         
273         Return a list of the words in the string S, using sep as the
274         delimiter string, starting at the end of the string and working
275         to the front.  If maxsplit is given, at most maxsplit splits are
276         done. If sep is not specified or is None, any whitespace string
277         is a separator.
278         """
279         return []
280     def rstrip(self, chars=None):  
281         """
282         S.rstrip([chars]) -> string or unicode
283         
284         Return a copy of the string S with trailing whitespace removed.
285         If chars is given and not None, remove characters in chars instead.
286         If chars is unicode, S will be converted to unicode before stripping
287         """
288         return ""
289     def split(self, sep=None, maxsplit=None):  
290         """ 分割,maxsplit,最多分割几次 """
291         """
292         S.split([sep [,maxsplit]]) -> list of strings
293         
294         Return a list of the words in the string S, using sep as the
295         delimiter string.  If maxsplit is given, at most maxsplit
296         splits are done. If sep is not specified or is None, any
297         whitespace string is a separator and empty strings are removed
298         from the result.
299         """
300         return []
301     def splitlines(self, keepends=False):  
302         """ 根据换行符分割 """
303         """
304         S.splitlines(keepends=False) -> list of strings
305         
306         Return a list of the lines in S, breaking at line boundaries.
307         Line breaks are not included in the resulting list unless keepends
308         is given and true.
309         """
310         return []
311     def startswith(self, prefix, start=None, end=None):  
312         """ 是否起始 """
313         """
314         S.startswith(prefix[, start[, end]]) -> bool
315         
316         Return True if S starts with the specified prefix, False otherwise.
317         With optional start, test S beginning at that position.
318         With optional end, stop comparing S at that position.
319         prefix can also be a tuple of strings to try.
320         """
321         return False
322     def strip(self, chars=None):  
323         """ 移除两边的空白 """
324         """
325         S.strip([chars]) -> string or unicode
326         
327         Return a copy of the string S with leading and trailing
328         whitespace removed.
329         If chars is given and not None, remove characters in chars instead.
330         If chars is unicode, S will be converted to unicode before stripping
331         """
332         return ""
333     def swapcase(self):  
334         """ 大写变小写,小写变大写 """
335         """
336         S.swapcase() -> string
337         
338         Return a copy of the string S with uppercase characters
339         converted to lowercase and vice versa.
340         """
341         return ""
342     def title(self):  
343         """ 设置为标题 """
344         """
345         S.title() -> string
346         
347         Return a titlecased version of S, i.e. words start with uppercase
348         characters, all remaining cased characters have lowercase.
349         """
350         return ""
351     def translate(self, table, deletechars=None):  
352         """
353         转换,需要先做一个对应表,最后一个表示删除字符集合
354         intab = "aeiou"
355         outtab = "12345"
356         trantab = maketrans(intab, outtab)
357         str = "this is string example....wow!!!"
358         print str.translate(trantab, 'xm')
359         """
360         """
361         S.translate(table [,deletechars]) -> string
362         
363         Return a copy of the string S, where all characters occurring
364         in the optional argument deletechars are removed, and the
365         remaining characters have been mapped through the given
366         translation table, which must be a string of length 256 or None.
367         If the table argument is None, no translation is applied and
368         the operation simply removes the characters in deletechars.
369         """
370         return ""
371     def upper(self):  
372         """
373         """ 转换为大写 """
374         S.upper() -> string
375         
376         Return a copy of the string S converted to uppercase.
377         """
378         return ""
379     def zfill(self, width):  
380         """ 方法返回指定长度的字符串,原字符串右对齐,前面填充0"""
381         """
382         S.zfill(width) -> string
383         
384         Pad a numeric string S with zeros on the left, to fill a field
385         of the specified width.  The string S is never truncated.
386         """
387         return ""
388     def _formatter_field_name_split(self, *args, **kwargs): # real signature unknown
389         pass
390     def _formatter_parser(self, *args, **kwargs): # real signature unknown
391         pass
392     def __add__(self, y):  
393         """ x.__add__(y) <==> x+y """
394         pass
395     def __contains__(self, y):  
396         """ x.__contains__(y) <==> y in x """
397         pass
398     def __eq__(self, y):  
399         """ x.__eq__(y) <==> x==y """
400         pass
401     def __format__(self, format_spec):  
402         """
403         S.__format__(format_spec) -> string
404         
405         Return a formatted version of S as described by format_spec.
406         """
407         return ""
408     def __getattribute__(self, name):  
409         """ x.__getattribute__('name') <==> x.name """
410         pass
411     def __getitem__(self, y):  
412         """ x.__getitem__(y) <==> x[y] """
413         pass
414     def __getnewargs__(self, *args, **kwargs): # real signature unknown
415         pass
416     def __getslice__(self, i, j):  
417         """
418         x.__getslice__(i, j) <==> x[i:j]
419                    
420                    Use of negative indices is not supported.
421         """
422         pass
423     def __ge__(self, y):  
424         """ x.__ge__(y) <==> x>=y """
425         pass
426     def __gt__(self, y):  
427         """ x.__gt__(y) <==> x>y """
428         pass
429     def __hash__(self):  
430         """ x.__hash__() <==> hash(x) """
431         pass
432     def __init__(self, string=''): # known special case of str.__init__
433         """
434         str(object='') -> string
435         
436         Return a nice string representation of the object.
437         If the argument is a string, the return value is the same object.
438         # (copied from class doc)
439         """
440         pass
441     def __len__(self):  
442         """ x.__len__() <==> len(x) """
443         pass
444     def __le__(self, y):  
445         """ x.__le__(y) <==> x<=y """
446         pass
447     def __lt__(self, y):  
448         """ x.__lt__(y) <==> x<y """
449         pass
450     def __mod__(self, y):  
451         """ x.__mod__(y) <==> x%y """
452         pass
453     def __mul__(self, n):  
454         """ x.__mul__(n) <==> x*n """
455         pass
456     @staticmethod # known case of __new__
457     def __new__(S, *more):  
458         """ T.__new__(S, ...) -> a new object with type S, a subtype of T """
459         pass
460     def __ne__(self, y):  
461         """ x.__ne__(y) <==> x!=y """
462         pass
463     def __repr__(self):  
464         """ x.__repr__() <==> repr(x) """
465         pass
466     def __rmod__(self, y):  
467         """ x.__rmod__(y) <==> y%x """
468         pass
469     def __rmul__(self, n):  
470         """ x.__rmul__(n) <==> n*x """
471         pass
472     def __sizeof__(self):  
473         """ S.__sizeof__() -> size of S in memory, in bytes """
474         pass
475     def __str__(self):  
476         """ x.__str__() <==> str(x) """
477         pass
478 str
str

8、列表

  1 class list(object):
  2     """
  3     list() -> new empty list
  4     list(iterable) -> new list initialized from iterable's items
  5     """
  6     def append(self, p_object): # real signature unknown; restored from __doc__
  7         """ L.append(object) -- append object to end """
  8         pass
  9     def count(self, value): # real signature unknown; restored from __doc__
 10         """ L.count(value) -> integer -- return number of occurrences of value """
 11         return 0
 12     def extend(self, iterable): # real signature unknown; restored from __doc__
 13         """ L.extend(iterable) -- extend list by appending elements from the iterable """
 14         pass
 15     def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__
 16         """
 17         L.index(value, [start, [stop]]) -> integer -- return first index of value.
 18         Raises ValueError if the value is not present.
 19         """
 20         return 0
 21     def insert(self, index, p_object): # real signature unknown; restored from __doc__
 22         """ L.insert(index, object) -- insert object before index """
 23         pass
 24     def pop(self, index=None): # real signature unknown; restored from __doc__
 25         """
 26         L.pop([index]) -> item -- remove and return item at index (default last).
 27         Raises IndexError if list is empty or index is out of range.
 28         """
 29         pass
 30     def remove(self, value): # real signature unknown; restored from __doc__
 31         """
 32         L.remove(value) -- remove first occurrence of value.
 33         Raises ValueError if the value is not present.
 34         """
 35         pass
 36     def reverse(self): # real signature unknown; restored from __doc__
 37         """ L.reverse() -- reverse *IN PLACE* """
 38         pass
 39     def sort(self, cmp=None, key=None, reverse=False): # real signature unknown; restored from __doc__
 40         """
 41         L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;
 42         cmp(x, y) -> -1, 0, 1
 43         """
 44         pass
 45     def __add__(self, y): # real signature unknown; restored from __doc__
 46         """ x.__add__(y) <==> x+y """
 47         pass
 48     def __contains__(self, y): # real signature unknown; restored from __doc__
 49         """ x.__contains__(y) <==> y in x """
 50         pass
 51     def __delitem__(self, y): # real signature unknown; restored from __doc__
 52         """ x.__delitem__(y) <==> del x[y] """
 53         pass
 54     def __delslice__(self, i, j): # real signature unknown; restored from __doc__
 55         """
 56         x.__delslice__(i, j) <==> del x[i:j]
 57                    
 58                    Use of negative indices is not supported.
 59         """
 60         pass
 61     def __eq__(self, y): # real signature unknown; restored from __doc__
 62         """ x.__eq__(y) <==> x==y """
 63         pass
 64     def __getattribute__(self, name): # real signature unknown; restored from __doc__
 65         """ x.__getattribute__('name') <==> x.name """
 66         pass
 67     def __getitem__(self, y): # real signature unknown; restored from __doc__
 68         """ x.__getitem__(y) <==> x[y] """
 69         pass
 70     def __getslice__(self, i, j): # real signature unknown; restored from __doc__
 71         """
 72         x.__getslice__(i, j) <==> x[i:j]
 73                    
 74                    Use of negative indices is not supported.
 75         """
 76         pass
 77     def __ge__(self, y): # real signature unknown; restored from __doc__
 78         """ x.__ge__(y) <==> x>=y """
 79         pass
 80     def __gt__(self, y): # real signature unknown; restored from __doc__
 81         """ x.__gt__(y) <==> x>y """
 82         pass
 83     def __iadd__(self, y): # real signature unknown; restored from __doc__
 84         """ x.__iadd__(y) <==> x+=y """
 85         pass
 86     def __imul__(self, y): # real signature unknown; restored from __doc__
 87         """ x.__imul__(y) <==> x*=y """
 88         pass
 89     def __init__(self, seq=()): # known special case of list.__init__
 90         """
 91         list() -> new empty list
 92         list(iterable) -> new list initialized from iterable's items
 93         # (copied from class doc)
 94         """
 95         pass
 96     def __iter__(self): # real signature unknown; restored from __doc__
 97         """ x.__iter__() <==> iter(x) """
 98         pass
 99     def __len__(self): # real signature unknown; restored from __doc__
100         """ x.__len__() <==> len(x) """
101         pass
102     def __le__(self, y): # real signature unknown; restored from __doc__
103         """ x.__le__(y) <==> x<=y """
104         pass
105     def __lt__(self, y): # real signature unknown; restored from __doc__
106         """ x.__lt__(y) <==> x<y """
107         pass
108     def __mul__(self, n): # real signature unknown; restored from __doc__
109         """ x.__mul__(n) <==> x*n """
110         pass
111     @staticmethod # known case of __new__
112     def __new__(S, *more): # real signature unknown; restored from __doc__
113         """ T.__new__(S, ...) -> a new object with type S, a subtype of T """
114         pass
115     def __ne__(self, y): # real signature unknown; restored from __doc__
116         """ x.__ne__(y) <==> x!=y """
117         pass
118     def __repr__(self): # real signature unknown; restored from __doc__
119         """ x.__repr__() <==> repr(x) """
120         pass
121     def __reversed__(self): # real signature unknown; restored from __doc__
122         """ L.__reversed__() -- return a reverse iterator over the list """
123         pass
124     def __rmul__(self, n): # real signature unknown; restored from __doc__
125         """ x.__rmul__(n) <==> n*x """
126         pass
127     def __setitem__(self, i, y): # real signature unknown; restored from __doc__
128         """ x.__setitem__(i, y) <==> x[i]=y """
129         pass
130     def __setslice__(self, i, j, y): # real signature unknown; restored from __doc__
131         """
132         x.__setslice__(i, j, y) <==> x[i:j]=y
133                    
134                    Use  of negative indices is not supported.
135         """
136         pass
137     def __sizeof__(self): # real signature unknown; restored from __doc__
138         """ L.__sizeof__() -- size of L in memory, in bytes """
139         pass
140     __hash__ = None
list

9、元组 

 1 class tuple(object):
 2     """
 3     tuple() -> empty tuple
 4     tuple(iterable) -> tuple initialized from iterable's items
 5     
 6     If the argument is a tuple, the return value is the same object.
 7     """
 8     def count(self, value): # real signature unknown; restored from __doc__
 9         """ T.count(value) -> integer -- return number of occurrences of value """
10         return 0
11     def index(self, value, start=None, stop=None): # real signature unknown; restored from __doc__
12         """
13         T.index(value, [start, [stop]]) -> integer -- return first index of value.
14         Raises ValueError if the value is not present.
15         """
16         return 0
17     def __add__(self, y): # real signature unknown; restored from __doc__
18         """ x.__add__(y) <==> x+y """
19         pass
20     def __contains__(self, y): # real signature unknown; restored from __doc__
21         """ x.__contains__(y) <==> y in x """
22         pass
23     def __eq__(self, y): # real signature unknown; restored from __doc__
24         """ x.__eq__(y) <==> x==y """
25         pass
26     def __getattribute__(self, name): # real signature unknown; restored from __doc__
27         """ x.__getattribute__('name') <==> x.name """
28         pass
29     def __getitem__(self, y): # real signature unknown; restored from __doc__
30         """ x.__getitem__(y) <==> x[y] """
31         pass
32     def __getnewargs__(self, *args, **kwargs): # real signature unknown
33         pass
34     def __getslice__(self, i, j): # real signature unknown; restored from __doc__
35         """
36         x.__getslice__(i, j) <==> x[i:j]
37                    
38                    Use of negative indices is not supported.
39         """
40         pass
41     def __ge__(self, y): # real signature unknown; restored from __doc__
42         """ x.__ge__(y) <==> x>=y """
43         pass
44     def __gt__(self, y): # real signature unknown; restored from __doc__
45         """ x.__gt__(y) <==> x>y """
46         pass
47     def __hash__(self): # real signature unknown; restored from __doc__
48         """ x.__hash__() <==> hash(x) """
49         pass
50     def __init__(self, seq=()): # known special case of tuple.__init__
51         """
52         tuple() -> empty tuple
53         tuple(iterable) -> tuple initialized from iterable's items
54         
55         If the argument is a tuple, the return value is the same object.
56         # (copied from class doc)
57         """
58         pass
59     def __iter__(self): # real signature unknown; restored from __doc__
60         """ x.__iter__() <==> iter(x) """
61         pass
62     def __len__(self): # real signature unknown; restored from __doc__
63         """ x.__len__() <==> len(x) """
64         pass
65     def __le__(self, y): # real signature unknown; restored from __doc__
66         """ x.__le__(y) <==> x<=y """
67         pass
68     def __lt__(self, y): # real signature unknown; restored from __doc__
69         """ x.__lt__(y) <==> x<y """
70         pass
71     def __mul__(self, n): # real signature unknown; restored from __doc__
72         """ x.__mul__(n) <==> x*n """
73         pass
74     @staticmethod # known case of __new__
75     def __new__(S, *more): # real signature unknown; restored from __doc__
76         """ T.__new__(S, ...) -> a new object with type S, a subtype of T """
77         pass
78     def __ne__(self, y): # real signature unknown; restored from __doc__
79         """ x.__ne__(y) <==> x!=y """
80         pass
81     def __repr__(self): # real signature unknown; restored from __doc__
82         """ x.__repr__() <==> repr(x) """
83         pass
84     def __rmul__(self, n): # real signature unknown; restored from __doc__
85         """ x.__rmul__(n) <==> n*x """
86         pass
tuple

10、字典

PS:字典循环时默认循环key
  1 class dict(object):
  2     """
  3     dict() -> new empty dictionary
  4     dict(mapping) -> new dictionary initialized from a mapping object's
  5         (key, value) pairs
  6     dict(iterable) -> new dictionary initialized as if via:
  7         d = {}
  8         for k, v in iterable:
  9             d[k] = v
 10     dict(**kwargs) -> new dictionary initialized with the name=value pairs
 11         in the keyword argument list.  For example:  dict(one=1, two=2)
 12     """
 13     def clear(self): # real signature unknown; restored from __doc__
 14         """ D.clear() -> None.  Remove all items from D. """
 15         """ 清除内容 """
 16         pass
 17     def copy(self): # real signature unknown; restored from __doc__
 18         """ 浅copy,
 19         """ D.copy() -> a shallow copy of D """
 20         pass
 21     @staticmethod # known case
 22     def fromkeys(S, v=None): # real signature unknown; restored from __doc__
 23         """ 查询key值是否在字典中"""
 24         """
 25         dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.
 26         v defaults to None.
 27         """
 28         pass
 29     def get(self, k, d=None): # real signature unknown; restored from __doc__
 30         """ D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None. """
 31        """ 根据key获取值,d是默认值 """
 32         pass
 33     def has_key(self, k): # real signature unknown; restored from __doc__
 34         """ D.has_key(k) -> True if D has a key k, else False """
 35         """ key是否在字典中 """
 36         return False
 37     def items(self): # real signature unknown; restored from __doc__
 38         """ D.items() -> list of D's (key, value) pairs, as 2-tuples """
 39         """ 会得到一个列表,列表内key与value组成一个元组 """
 40         return []
 41     def iteritems(self): # real signature unknown; restored from __doc__
 42         """ D.iteritems() -> an iterator over the (key, value) items of D """
 43         """ 项可迭代 """
 44         pass
 45     def iterkeys(self): # real signature unknown; restored from __doc__
 46         """ D.iterkeys() -> an iterator over the keys of D """
 47         """ key可迭代 """
 48         pass
 49     def itervalues(self): # real signature unknown; restored from __doc__
 50         """ D.itervalues() -> an iterator over the values of D """
 51         """ value可迭代 """
 52         pass
 53     def keys(self): # real signature unknown; restored from __doc__
 54         """ D.keys() -> list of D's keys """
 55         """ 列出所有keys """
 56         return []
 57     def pop(self, k, d=None): # real signature unknown; restored from __doc__
 58         """
 59         D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
 60         If key is not found, d is returned if given, otherwise KeyError is raised
 61         """
 62         """ 获取并在字典中移除 """
 63         pass
 64     def popitem(self): # real signature unknown; restored from __doc__
 65         """
 66         D.popitem() -> (k, v), remove and return some (key, value) pair as a
 67         2-tuple; but raise KeyError if D is empty.
 68         """
 69         """ 获取并在字典中移项"""
 70         pass
 71     def setdefault(self, k, d=None): # real signature unknown; restored from __doc__
 72         """ D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D """
 73        """ 如果key不存在,则创建,如果存在,则返回已存在的值且不修改 """
 74         pass
 75     def update(self, E=None, **F): # known special case of dict.update
 76         """
 77         D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
 78         If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
 79         If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
 80         In either case, this is followed by: for k in F: D[k] = F[k]
 81         """
 82         """ 更新 """
 83         pass
 84     def values(self): # real signature unknown; restored from __doc__
 85         """ D.values() -> list of D's values """
 86         """ 所有的value """
 87         return []
 88     def viewitems(self): # real signature unknown; restored from __doc__
 89         """ D.viewitems() -> a set-like object providing a view on D's items """
 90         """ 所有项,只是将内容保存至view对象中 """
 91         pass
 92     def viewkeys(self): # real signature unknown; restored from __doc__
 93         """ D.viewkeys() -> a set-like object providing a view on D's keys """
 94         pass
 95     def viewvalues(self): # real signature unknown; restored from __doc__
 96         """ D.viewvalues() -> an object providing a view on D's values """
 97         pass
 98     def __cmp__(self, y): # real signature unknown; restored from __doc__
 99         """ x.__cmp__(y) <==> cmp(x,y) """
100         pass
101     def __contains__(self, k): # real signature unknown; restored from __doc__
102         """ D.__contains__(k) -> True if D has a key k, else False """
103         return False
104     def __delitem__(self, y): # real signature unknown; restored from __doc__
105         """ x.__delitem__(y) <==> del x[y] """
106         pass
107     def __eq__(self, y): # real signature unknown; restored from __doc__
108         """ x.__eq__(y) <==> x==y """
109         pass
110     def __getattribute__(self, name): # real signature unknown; restored from __doc__
111         """ x.__getattribute__('name') <==> x.name """
112         pass
113     def __getitem__(self, y): # real signature unknown; restored from __doc__
114         """ x.__getitem__(y) <==> x[y] """
115         pass
116     def __ge__(self, y): # real signature unknown; restored from __doc__
117         """ x.__ge__(y) <==> x>=y """
118         pass
119     def __gt__(self, y): # real signature unknown; restored from __doc__
120         """ x.__gt__(y) <==> x>y """
121         pass
122     def __init__(self, seq=None, **kwargs): # known special case of dict.__init__
123         """
124         dict() -> new empty dictionary
125         dict(mapping) -> new dictionary initialized from a mapping object's
126             (key, value) pairs
127         dict(iterable) -> new dictionary initialized as if via:
128             d = {}
129             for k, v in iterable:
130                 d[k] = v
131         dict(**kwargs) -> new dictionary initialized with the name=value pairs
132             in the keyword argument list.  For example:  dict(one=1, two=2)
133         # (copied from class doc)
134         """
135         pass
136     def __iter__(self): # real signature unknown; restored from __doc__
137         """ x.__iter__() <==> iter(x) """
138         pass
139     def __len__(self): # real signature unknown; restored from __doc__
140         """ x.__len__() <==> len(x) """
141         pass
142     def __le__(self, y): # real signature unknown; restored from __doc__
143         """ x.__le__(y) <==> x<=y """
144         pass
145     def __lt__(self, y): # real signature unknown; restored from __doc__
146         """ x.__lt__(y) <==> x<y """
147         pass
148     @staticmethod # known case of __new__
149     def __new__(S, *more): # real signature unknown; restored from __doc__
150         """ T.__new__(S, ...) -> a new object with type S, a subtype of T """
151         pass
152     def __ne__(self, y): # real signature unknown; restored from __doc__
153         """ x.__ne__(y) <==> x!=y """
154         pass
155     def __repr__(self): # real signature unknown; restored from __doc__
156         """ x.__repr__() <==> repr(x) """
157         pass
158     def __setitem__(self, i, y): # real signature unknown; restored from __doc__
159         """ x.__setitem__(i, y) <==> x[i]=y """
160         pass
161     def __sizeof__(self): # real signature unknown; restored from __doc__
162         """ D.__sizeof__() -> size of D in memory, in bytes """
163         pass
164     __hash__ = None
dict

11、集合

 

12、其它

编码转换

1 >>> ""
2 '\xe6\x97\xa0'
3 >>> str1 = '\xe6\x97\xa0'
4 >>> str1.decode('utf-8')
5 u'\u65e0'
6 >>> str1.decode('utf-8').encode('gbk')
7 '\xce\xde'
8 >>> print str1.decode('utf-8').encode('gbk')
9 ��

字符格式化    S.format()

1 >>> name = 'i am {0},age {1}'
2 >>> name.format('kim',12)
3 'i am kim,age 12'
4 >>> name = 'i am {aa},age {bb}'
5 >>> name.format(aa='kim',bb=12)
6 ''i am kim,age 12'
1 >>> name = 'i am {0},age {1}'
2 >>> li = ['kim',13]
3 >>> name.format(*li)
4 'i am kim,age 13'
5 >>> name = 'i am {aa},age {bb}'
6 >>> dc = {'aa':'kim','bb':13}
7 >>> name.format(**dc)
8 'i am kim,age 13'

参考链接:

http://www.cnblogs.com/wupeiqi/articles/4911365.html

 

转载于:https://www.cnblogs.com/YaYaTang/p/4944670.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/574200.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

(转)数字格式化函数:Highcharts.numberFormat()

一、函数说明 该函数用于图表中数值的格式化&#xff0c;常见用途有数值精度控制、小数点符、千位符显示控制等。二、函数使用1、函数构造及参数Highcharts.numberFormat (Number number, [Number decimals], [String decimalPoint], [String thousandsSep])参数列表number 需…

cad图层管理插件_设计大神CAD常用七个插件你会用几个?

如果你需要这些CAD插件&#xff0c;可以私信我&#xff0c;小编会及时发给大家​​ 说道CAD插件可能会被人们熟知的也就那几个&#xff0c;可是据统计CAD插件多达上百个&#xff0c;那么在这上百个插件中你又会用几个呢&#xff1f;下面就让我们看看大部分设计师常用的插件有哪…

笔记本显示器仅计算机,别只玩性能 笔记本屏幕怎么进化才靠谱?

1分辨率升级2K不合适一直以来&#xff0c;屏幕显示效果都是笔记本电脑的弱项。近几年笔记本电脑的变化更多是性能以及外观设计的变迁。诸如游戏本以及超极本等产品&#xff0c;在屏幕的优化上&#xff0c;表现都是差强人意。很多人手中的笔记本都是TN屏幕的产品&#xff0c;在显…

计算机专业刚毕业本科生,计算机专业应届本科毕业生自我鉴定

计算机专业应届本科毕业生自我鉴定四年的大学生活是我人生这条线上的一小段&#xff0c;是闪闪发光的一段&#xff0c;它包含了汗水和收获&#xff0c;为我划平人生的线起着至关重要的作用。四年大学生活已接近尾声&#xff0c;感觉非常有必要总结一下大学四年的得失&#xff0…

佳能c3320怎么设置接收方_入门级单反相机佳能800D是否值得买?在我看来价格决定一切...

佳能入门级单反相机800D是否值得买看了就清楚旺灵龙如果你是一位刚刚准备购买数码单反相机的入门小白&#xff0c;佳能最新的EOS 800D的肯定是你现在最容易拿来对比的选择。新相机在性能与操作便利性方面的良好结合&#xff0c;无疑将是入门级单反性价比最高的一款机型。佳能(C…

stm8时钟源

下面4种时钟源可用做主时钟&#xff1a; 1-24MHz高速外部晶体振荡器(HSE)最大24MHz高速外部时钟信号(HSE user-ext)16MHz高速内部RC振荡器(HSI)128KHz低速内部RC(LSI)各个时钟源可单独打开或关闭&#xff0c;从而优化功耗。 (一)HSE 高速外部时钟信号可由下面两个时钟源产生&am…

nexus 仓库类型_Maven私服Nexus的搭建

私服存在的合理性Maven中的依赖是从服务器仓库中下载的&#xff0c;Maven的仓库只有两大类&#xff1a;本地仓库远程仓库&#xff0c;其中在远程仓库中又分成了3种&#xff1a;中央仓库 、私服、其它公共库。Maven用户直接连接远程仓库下载构件的做法是Maven不建议使用的&#…

ae中心点重置工具_AE中图形绘制的6大技巧,简单易操作

AE中的图形系统和文字系统很相似&#xff0c;都有自己相对独立的一套基础动画系统。当我们打开AE软件&#xff0c;面对空白的面板&#xff0c;如何通过一步步的操作填充画面&#xff0c;做出酷炫的效果&#xff0c;这其中图形占据很大的比重&#xff0c;更不用说流行的MG动画&a…

Mac安装软件报“打不开。。。,因为它来自身份不明的开发者”的解决办法

问题描述 在Mac上安装git&#xff0c;双击pkg进行安装&#xff0c;报如下图错误&#xff1a; 解决办法 不要双击pkg文件&#xff0c;改成选中文件之后&#xff0c;鼠标右键&#xff0c;选择“打开方式->安装器&#xff08;默认&#xff09;”&#xff0c;即可继续安装。 转载…

模型预测控制c语言程序_搭建第一个程序控制电路LED灯,体会C语言的魅力

学习C语言&#xff0c;先从读程序开始&#xff01;这一点是过来人的经验之谈。本文建议大家选择一款图形编程软件&#xff0c;本文选择了Mixly。一、首先&#xff0c;介绍一下arduino UNO控制器内部电压的问题。v 高电平(5V)&#xff1a;对应数值是1&#xff0c;输入状态3.5V-5…

s丅7318是啥芯片_透彻解析LED驱动芯片HT1632C指令集与驱动编程

HT1632C是一款很常用的LED(数码管或点阵)驱动芯片&#xff0c;虽然官方已经宣布该芯片明年(2021年)即将寿终正寝(停产)&#xff0c;但是相同厂家生产的同系列芯片的控制方式通常是相同的(事实上&#xff0c;大多数LED驱动芯片差别也不大)&#xff0c;所以了解HT1632C的控制原理…

服务器显示不明用户远程过,服务器显示不明用户远程过

服务器显示不明用户远程过 内容精选换一换Windows操作系统云服务器蓝屏&#xff0c;如图1所示。使用了来源不明的第三方软件。CPU占用过高导致。因为误操作或者病毒引起的系统文件、注册表损坏。操作系统在蓝屏的情况下&#xff0c;会显示对应的bugcheck code以及可能的导致蓝屏…

微信小程序定义全局变量_微信小程序第二天学习内容分享

微信小程序的生命周期文件的配置在app.js文件中&#xff1b;方法&#xff1a;onLaunch,onShow,onHideapi链接&#xff1a;https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onHideonError,当前也可以自定义&#xff0c;用console测试事件的执行情况&a…

java环境配置—配置Tomcat8环境

先安装JDK&#xff0c;配置好jdk环境后再配置Tomcat 8配置环境变量&#xff1a;TOMCAT_HOME&#xff1a;D:\Program Files\apache-tomcat-8.0.28  CATALINA_HOME:D:\Program Files\apache-tomcat-8.0.28  CATALINA_BASE:D:\Program Files\apache-tomcat-8.0.28修改CLASSPAT…

ios13苹方字体ttf_字体 | iOS1013 SF Compact Rounded 英文 By alex

最近沉迷游戏&#xff0c;差点忘记了这个英文。嗨呀&#xff0c;问就是在玩了&#xff0c;啊不&#xff0c;在做了。这个英文来自推特alexman&#xff0c;原版包含100和85大小&#xff0c;本次分享新增到了100-60&#xff0c;每5%一个大小。gzh分享已经获得alex授权&#xff0c…

10双屏鼠标过不去_灵耀X2 Duo双屏笔记本是怎样“炼”成的?对话华硕笔记本设计团队...

2020年的CES上&#xff0c;华硕推出了一款灵耀X2 Duo笔记本&#xff0c;灵耀X2 Duo采用了和灵耀X2 Pro相同的屏幕技术&#xff0c;C面同样采用了一块ScreenPad Plus副屏&#xff0c;机身也更轻更薄。如今灵耀X2 Duo的处理器升级至英特尔第十代酷睿&#xff0c;正在参与“618”大…

理解 OpenStack 高可用(HA) (6): MySQL HA

本系列会分析OpenStack 的高可用性&#xff08;HA&#xff09;概念和解决方案&#xff1a; &#xff08;1&#xff09;OpenStack 高可用方案概述 &#xff08;2&#xff09;Neutron L3 Agent HA - VRRP &#xff08;虚拟路由冗余协议&#xff09; &#xff08;3&#xff09;Neu…

聚类中心坐标公式如何使用_如何使用CAD看图软件来测量坐标?

当我们在拿到图纸的时候&#xff0c;经常会需要使用测量工具&#xff0c;再次测量dwg图纸上的数据。浩辰CAD看图王软件&#xff0c;不仅可以看图&#xff0c;也可以编辑图纸&#xff0c;测量功能更是很方便&#xff0c;当我们在测量的时候&#xff0c;如何测量图纸上点的坐标呢…

德利捷读码器设置软件_S7-1500PLC+变频器+编码器组成位置控制系统

PLC学习中组成部分&#xff1a;位置控制、力矩控制、惯量控制。位置控制模式S7-1500 的运动控制功能支持轴的定位和移动&#xff0c;是 S7-1500 系列 CPU 众多集成功能中的重要组成部分。运动控制功能支持旋转轴、定位轴、同步轴和外部编码器等工艺对象。根据PLC-Open&#xff…

解决 c3p0 和 MySQL 集成情况下,连接长时间闲置后重新使用时报错的问题

MySQL 的默认设置下&#xff0c;当一个连接的空闲时间超过8小时后&#xff0c;MySQL 就会断开该连接&#xff0c;而 c3p0 连接池则以为该被断开的连接依然有效。在这种情况下&#xff0c;如果客户端代码向 c3p0 连接池请求连接的话&#xff0c;连接池就会把已经失效的连接返回给…