标签:
1 class set(object): 2 """ 3 set() -> new empty set object 4 set(iterable) -> new set object 5 6 Build an unordered collection of unique elements. 7 """ 8 wjh=set([‘1‘,‘2‘,‘3‘]) 9 wjh.add(‘4‘) 10 wjh.add(‘4‘) 11 print(wjh) 12 {‘4‘, ‘1‘, ‘3‘, ‘2‘} set中元素是唯一的 13 def add(self, *args, **kwargs): # real signature unknown 14 """ 添加 """ 15 """ 16 Add an element to a set. 17 18 This has no effect if the element is already present. 19 """ 20 pass 21 wjh.add(‘4‘) 22 23 def clear(self, *args, **kwargs): # real signature unknown 24 """ Remove all elements from this set. """ 25 pass 26 wjh.clear()清除set所有数据 27 28 def copy(self, *args, **kwargs): # real signature unknown 29 """ Return a shallow copy of a set. """ 30 pass 31 浅拷贝 32 33 34 def difference(self, *args, **kwargs): # real signature unknown 35 """ 36 Return the difference of two or more sets as a new set. 37 38 (i.e. all elements that are in this set but not the others.) 39 """ 40 pass 41 取两个set合集差异,取单集合 42 old = old_dict.keys() 43 new = new_dict.keys() 44 old_set=set(old) 45 new_set=set(new) 46 delete_set=old_set.difference(new_set) 47 print(delete_set) 48 {‘#2‘} 只取了old_set中的差异 49 50 def difference_update(self, *args, **kwargs): # real signature unknown 51 """ 删除当前set中的所有包含在 new set 里的元素 """ 52 """ Remove all elements of another set from this set. """ 53 pass 54 old = old_dict.keys() 55 new = new_dict.keys() 56 old_set=set(old) 57 new_set=set(new) 58 delete_update_set=old_set.difference_update(new_set) 59 print(old_set) 60 {‘#2‘} 删除old_set中与new相重叠的元素 61 62 def discard(self, *args, **kwargs): # real signature unknown 63 """ 移除元素 """ 64 """ 65 Remove an element from a set if it is a member. 66 67 If the element is not a member, do nothing. 68 """ 69 pass 70 new = new_dict.keys() 71 new_set=set(new) 72 delt=new_set.discard(‘#3‘) 73 print(new_set) 74 {‘#1‘, ‘#4‘}移除特定元素 75 76 77 def intersection(self, *args, **kwargs): # real signature unknown 78 """ 取交集,新创建一个set """ 79 """ 80 Return the intersection of two or more sets as a new set. 81 82 (i.e. elements that are common to all of the sets.) 83 """ 84 pass 85 old = old_dict.keys() 86 new = new_dict.keys() 87 old_set=set(old) 88 new_set=set(new) 89 new_jiaoji_set=new_set.intersection(old_set) 90 print(new_jiaoji_set) 91 {‘#3‘, ‘#1‘} 92 93 def intersection_update(self, *args, **kwargs): # real signature unknown 94 """ 取交集,修改原来set """ 95 """ Update a set with the intersection of itself and another. """ 96 pass 97 old = old_dict.keys() 98 new = new_dict.keys() 99 old_set=set(old) 100 new_set=set(new) 101 new_jiaoji_set=new_set.intersection_update(old_set) 102 print(new_set) 103 {‘#1‘, ‘#3‘} 104 105 def isdisjoint(self, *args, **kwargs): # real signature unknown 106 """ 如果没有交集,返回true """ 107 """ Return True if two sets have a null intersection. """ 108 pass 109 old = old_dict.keys() 110 new = new_dict.keys() 111 old_set=set(old) 112 new_set=set(new) 113 jieguo=new_set.isdisjoint(old_set) 114 print(jieguo) 115 False 116 117 def issubset(self, *args, **kwargs): # real signature unknown 118 """ 是否是子集 """ 119 """ Report whether another set contains this set. """ 120 pass 121 122 123 def issuperset(self, *args, **kwargs): # real signature unknown 124 """ 是否是父集 """ 125 """ Report whether this set contains another set. """ 126 pass 127 128 def pop(self, *args, **kwargs): # real signature unknown 129 """ 移除 """ 130 """ 131 Remove and return an arbitrary set element. 132 Raises KeyError if the set is empty. 133 """ 134 pass 135 old = old_dict.keys() 136 new = new_dict.keys() 137 old_set=set(old) 138 new_set=set(new) 139 pp=old_set.pop() 140 print(pp) 141 print(old_set) 142 #2 143 {‘#1‘, ‘#3‘} 144 随机移除一个元素 145 146 def remove(self, *args, **kwargs): # real signature unknown 147 """ 移除 """ 148 """ 149 Remove an element from a set; it must be a member. 150 151 If the element is not a member, raise a KeyError. 152 """ 153 pass 154 old = old_dict.keys() 155 new = new_dict.keys() 156 old_set=set(old) 157 new_set=set(new) 158 #print(old_set) 159 pp=old_set.remove(‘#3‘) 160 print(pp) 161 print(old_set) 162 {‘#1‘, ‘#2‘} 移除一个指定元素 163 164 def symmetric_difference(self, *args, **kwargs): # real signature unknown 165 """ 差集,创建新对象""" 166 """ 167 Return the symmetric difference of two sets as a new set. 168 169 (i.e. all elements that are in exactly one of the sets.) 170 """ 171 pass 172 old = old_dict.keys() 173 new = new_dict.keys() 174 old_set=set(old) 175 new_set=set(new) 176 cha=old_set.symmetric_difference(new_set) 177 print(cha) 178 {‘#4‘, ‘#2‘} 179 180 def symmetric_difference_update(self, *args, **kwargs): # real signature unknown 181 """ 差集,改变原来 """ 182 """ Update a set with the symmetric difference of itself and another. """ 183 pass 184 185 def union(self, *args, **kwargs): # real signature unknown 186 """ 并集 """ 187 """ 188 Return the union of sets as a new set. 189 190 (i.e. all elements that are in either set.) 191 """ 192 pass 193 old = old_dict.keys() 194 new = new_dict.keys() 195 old_set=set(old) 196 new_set=set(new) 197 unic=old_set.union(new_set) 198 print(unic) 199 {‘#3‘, ‘#1‘, ‘#4‘, ‘#2‘} 合并 200 201 def update(self, *args, **kwargs): # real signature unknown 202 """ 更新 """ 203 """ Update a set with the union of itself and others. """ 204 pass 205 old = old_dict.keys() 206 new = new_dict.keys() 207 old_set=set(old) 208 new_set=set(new) 209 update=old_set.update(new_set) 210 print(old_set) 211 {‘#1‘, ‘#2‘, ‘#4‘, ‘#3‘} 更新 212 213 def __and__(self, y): # real signature unknown; restored from __doc__ 214 """ x.__and__(y) <==> x&y """ 215 pass 216 217 def __cmp__(self, y): # real signature unknown; restored from __doc__ 218 """ x.__cmp__(y) <==> cmp(x,y) """ 219 pass 220 221 def __contains__(self, y): # real signature unknown; restored from __doc__ 222 """ x.__contains__(y) <==> y in x. """ 223 pass 224 225 def __eq__(self, y): # real signature unknown; restored from __doc__ 226 """ x.__eq__(y) <==> x==y """ 227 pass 228 229 def __getattribute__(self, name): # real signature unknown; restored from __doc__ 230 """ x.__getattribute__(‘name‘) <==> x.name """ 231 pass 232 233 def __ge__(self, y): # real signature unknown; restored from __doc__ 234 """ x.__ge__(y) <==> x>=y """ 235 pass 236 237 def __gt__(self, y): # real signature unknown; restored from __doc__ 238 """ x.__gt__(y) <==> x>y """ 239 pass 240 241 def __iand__(self, y): # real signature unknown; restored from __doc__ 242 """ x.__iand__(y) <==> x&=y """ 243 pass 244 245 def __init__(self, seq=()): # known special case of set.__init__ 246 """ 247 set() -> new empty set object 248 set(iterable) -> new set object 249 250 Build an unordered collection of unique elements. 251 # (copied from class doc) 252 """ 253 pass 254 255 def __ior__(self, y): # real signature unknown; restored from __doc__ 256 """ x.__ior__(y) <==> x|=y """ 257 pass 258 259 def __isub__(self, y): # real signature unknown; restored from __doc__ 260 """ x.__isub__(y) <==> x-=y """ 261 pass 262 263 def __iter__(self): # real signature unknown; restored from __doc__ 264 """ x.__iter__() <==> iter(x) """ 265 pass 266 267 def __ixor__(self, y): # real signature unknown; restored from __doc__ 268 """ x.__ixor__(y) <==> x^=y """ 269 pass 270 271 def __len__(self): # real signature unknown; restored from __doc__ 272 """ x.__len__() <==> len(x) """ 273 pass 274 275 def __le__(self, y): # real signature unknown; restored from __doc__ 276 """ x.__le__(y) <==> x<=y """ 277 pass 278 279 def __lt__(self, y): # real signature unknown; restored from __doc__ 280 """ x.__lt__(y) <==> x<y """ 281 pass 282 283 @staticmethod # known case of __new__ 284 def __new__(S, *more): # real signature unknown; restored from __doc__ 285 """ T.__new__(S, ...) -> a new object with type S, a subtype of T """ 286 pass 287 288 def __ne__(self, y): # real signature unknown; restored from __doc__ 289 """ x.__ne__(y) <==> x!=y """ 290 pass 291 292 def __or__(self, y): # real signature unknown; restored from __doc__ 293 """ x.__or__(y) <==> x|y """ 294 pass 295 296 def __rand__(self, y): # real signature unknown; restored from __doc__ 297 """ x.__rand__(y) <==> y&x """ 298 pass 299 300 def __reduce__(self, *args, **kwargs): # real signature unknown 301 """ Return state information for pickling. """ 302 pass 303 304 def __repr__(self): # real signature unknown; restored from __doc__ 305 """ x.__repr__() <==> repr(x) """ 306 pass 307 308 def __ror__(self, y): # real signature unknown; restored from __doc__ 309 """ x.__ror__(y) <==> y|x """ 310 pass 311 312 def __rsub__(self, y): # real signature unknown; restored from __doc__ 313 """ x.__rsub__(y) <==> y-x """ 314 pass 315 316 def __rxor__(self, y): # real signature unknown; restored from __doc__ 317 """ x.__rxor__(y) <==> y^x """ 318 pass 319 320 def __sizeof__(self): # real signature unknown; restored from __doc__ 321 """ S.__sizeof__() -> size of S in memory, in bytes """ 322 pass 323 324 def __sub__(self, y): # real signature unknown; restored from __doc__ 325 """ x.__sub__(y) <==> x-y """ 326 pass 327 328 def __xor__(self, y): # real signature unknown; restored from __doc__ 329 """ x.__xor__(y) <==> x^y """ 330 pass 331 332 __hash__ = None
set是一个无序且不重复的元素集合 练习:寻找差异 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 # 数据库中原有 old_dict = { "#1":{ ‘hostname‘:c1, ‘cpu_count‘: 2, ‘mem_capicity‘: 80 }, "#2":{ ‘hostname‘:c1, ‘cpu_count‘: 2, ‘mem_capicity‘: 80 } "#3":{ ‘hostname‘:c1, ‘cpu_count‘: 2, ‘mem_capicity‘: 80 } } # cmdb 新汇报的数据 new_dict = { "#1":{ ‘hostname‘:c1, ‘cpu_count‘: 2, ‘mem_capicity‘: 800 }, "#3":{ ‘hostname‘:c1, ‘cpu_count‘: 2, ‘mem_capicity‘: 80 } "#4":{ ‘hostname‘:c2, ‘cpu_count‘: 2, ‘mem_capicity‘: 80 } } 需要删除:? 需要新建:? 需要更新:? 注意:无需考虑内部元素是否改变,只要原来存在,新汇报也存在,就是需要更新
import copy 字符串,整数,浮点,列表,元组(深浅拷贝都一样) ‘‘‘ a1 = 1223444 a2 = a1 print(id(a1)) print(id(a2)) ‘‘‘ a1 = 123444 ‘‘‘ a2 = copy.copy(a1) print(id(a1)) print(id(a2)) ‘‘‘ ‘‘‘ a2=copy.deepcopy(a1) print(id(a1)) print(id(a2)) ‘‘‘ 当出现下面这种情况,包涵多个子值时,浅拷贝只会拷贝第一层的内存地址,而深拷贝则会拷贝除最后一层外所有。 n1 = {‘k1‘:‘v1‘,‘k2‘:‘v2‘,‘k3‘:[‘wjh‘,223,]} ‘‘‘ print(id(n1)) n2 = n1 print(id(n2)) ‘‘‘ 监控模板调用例子: #n2 = copy.copy(n1) n2 = copy.deepcopy(n1) #print(id(n1[‘k3‘])) #print(id(n2[‘k3‘])) dic = { ‘cpu‘:[80,], ‘mem‘:[80,], ‘disk‘:[80,], } #print(dic) new_dic=copy.deepcopy(dic) #print(new_dic) new_dic[‘cpu‘][0] = 50 print(dic) print(new_dic)
返回值: import smtplib from email.mime.text import MIMEText from email.utils import formataddr def mail(user): ret = True try: msg = MIMEText(‘邮件内容‘, ‘plain‘, ‘utf-8‘) msg[‘From‘] = formataddr(["武沛齐",‘wptawy@126.com‘]) msg[‘To‘] = formataddr(["走人",‘133130355@qq.com‘]) msg[‘Subject‘] = "主题" server = smtplib.SMTP("smtp.126.com", 25) server.login("wptawy@126.com", "WW.3945.59") server.sendmail(‘wptawy@126.com‘, [user,], msg.as_string()) server.quit() except Exception: ret = False return ret ret = mail(‘hdwangjianhui@163.com‘) if ret: print(‘success‘) else: print(‘shibai‘) 无参数: import smtplib from email.mime.text import MIMEText from email.utils import formataddr def mail(): msg = MIMEText(‘邮件内容‘, ‘plain‘, ‘utf-8‘) msg[‘From‘] = formataddr(["武沛齐",‘wptawy@126.com‘]) msg[‘To‘] = formataddr(["走人",‘424662508@qq.com‘]) msg[‘Subject‘] = "主题" server = smtplib.SMTP("smtp.126.com", 25) server.login("wptawy@126.com", "邮箱密码") server.sendmail(‘wptawy@126.com‘, [‘133130355@qq.com‘,], msg.as_string()) server.quit() mail() 普通参数: import smtplib from email.mime.text import MIMEText from email.utils import formataddr def mail(user): msg = MIMEText(‘邮件内容‘, ‘plain‘, ‘utf-8‘) msg[‘From‘] = formataddr(["武沛齐",‘wptawy@126.com‘]) msg[‘To‘] = formataddr(["走人",‘424662508@qq.com‘]) msg[‘Subject‘] = "主题" server = smtplib.SMTP("smtp.126.com", 25) server.login("wptawy@126.com", "邮箱密码") server.sendmail(‘wptawy@126.com‘, [user,], msg.as_string()) server.quit() mail(‘133130355@qq.com‘) 默认参数: def func(name, age = 18): print ("%s:%s" %(name,age)) # 指定参数 func(‘wupeiqi‘, 19) # 使用默认参数 func(‘alex‘) 动态参数: * def pr(*args): print(args) wjh=[‘1‘,‘2‘] pr(wjh) *可以传递元组,字符,列表 ** def pr(**args): print(args) pr(wjh={‘wjh‘:‘123‘,}) **可以传递字典 def pr(*args,**kwargs): print(args) print(kwargs) pr([1,2,3,4],wjh={‘wjh‘:‘123‘,}) 当两个参数都存在时一定要先写*的
可以将值从左右提取插入。 import collections d = collections.deque() d.append(‘1‘) d.appendleft(‘10‘) d.appendleft(‘1‘) print(d) print(d.count(‘1‘)) d.extend([‘y‘,‘yy‘,‘n‘])#扩展 d.extendleft([‘t‘,‘1‘]) d.rotate(1) #将最后一个值放到第一个 单向队列: 只能将值从左到右传入,取出,(类似子弹夹原理) import queue #qsize:查看队列元素个数 #empty:清除 #full:是否填满 #put:插入数据 #get:取数据 q = queue.Queue() q.put(‘123‘) q.put(‘456‘) print(q.qsize()) print (q.get())
有序字典: import collections dic = collections.OrderedDict() dic[‘a‘] = ‘a1‘ dic[‘b‘] = ‘b1‘ dic[‘c‘] = ‘c1‘ print(dic) 通过列表去像字典传输元素,以达到有顺序。 默认字典: dic = collections.defaultdict(list)定义默认字典的元素为list。 #dic={} a = [11,22,33,44,55,66,77,88,99] for i in a: if i >66: dic[‘k1‘].append(i) else: dic[‘v2‘].append(i) 可命名元组: print(dic)name_tuple=collections.namedtuple(‘name_tuple‘,[‘x‘,‘y‘,‘z‘]) tuple1=name_tuple(11,22,33) print(tuple1.x) print(tuple1.y)
查看详细:https://docs.python.org/3/library/functions.html#next
abs()绝对值 all()当所有值为真才为真:None,Flase,空,都为假 a=all([‘1‘,]) print(a) True any()当其中值任意一个为真就为真。 bin()查看整数二进制 bool()查看布尔类型:Ture/Flase chr()将整数转换为计算机识别的字符: a = chr(81) print(a) Q 可用于验证码 ord()将字符转换为数字: a = ord(‘A‘) print(a) 65 random:生成随机数。 import random print(random.randint(1,99)) dict():生成字典。 dir():查看对象可以使用的操作。 a = dir(111) print(a) [‘__abs__‘, ‘__add__‘, ‘__and__‘, ‘__bool__‘, ‘__ceil__‘, ‘__class__‘, ‘__delattr__‘, ‘__dir__‘, ‘__divmod__‘, ‘__doc__‘, ‘__eq__‘, ‘__float__‘, ‘__floor__‘, ‘__floordiv__‘, ‘__format__‘, ‘__ge__‘, ‘__getattribute__‘, ‘__getnewargs__‘, ‘__gt__‘, ‘__hash__‘, ‘__index__‘, ‘__init__‘, ‘__int__‘, ‘__invert__‘, ‘__le__‘, ‘__lshift__‘, ‘__lt__‘, ‘__mod__‘, ‘__mul__‘, ‘__ne__‘, ‘__neg__‘, ‘__new__‘, ‘__or__‘, ‘__pos__‘, ‘__pow__‘, ‘__radd__‘, ‘__rand__‘, ‘__rdivmod__‘, ‘__reduce__‘, ‘__reduce_ex__‘, ‘__repr__‘, ‘__rfloordiv__‘, ‘__rlshift__‘, ‘__rmod__‘, ‘__rmul__‘, ‘__ror__‘, ‘__round__‘, ‘__rpow__‘, ‘__rrshift__‘, ‘__rshift__‘, ‘__rsub__‘, ‘__rtruediv__‘, ‘__rxor__‘, ‘__setattr__‘, ‘__sizeof__‘, ‘__str__‘, ‘__sub__‘, ‘__subclasshook__‘, ‘__truediv__‘, ‘__trunc__‘, ‘__xor__‘, ‘bit_length‘, ‘conjugate‘, ‘denominator‘, ‘from_bytes‘, ‘imag‘, ‘numerator‘, ‘real‘, ‘to_bytes‘] divmod:整除并且返回余数。 enumerate:将目标加上序号。 wjh={ ‘wjh1‘:‘11‘, ‘wjh2‘:‘22‘, } for i,v in enumerate(wjh,2): print(i,v) 2 wjh2 3 wjh1 eval():函数将字符串str当成有效Python表达式来求值,并返回计算结果。 r = 1 print eval() r =1 print (eval(‘r + 1‘)) float():浮点数。 help():帮助。 id():查看内存地址。 input():插入。 int():整数。 hex():16进制转换。 len():长度。 list():列表 min():最小值 max():最大值 oct():八进制 open():打开文件 print():打印 pow():次方 import math a = pow(2,2) print(a) range():定义数量 reversed():反转 set():定义唯一集合 round():大约,约等于 sorted():排序 str():字符串 sum():求和 tuple():元组 type():类型 vars():查看内置方法 class a: foo=100 b = vars(a) print(b) zip():将数组进行组合成列表。 map():map函数会根据提供的函数对指定序列做映射。 lil=[22,23,24,] new_li=map(lambda x:x + 100,lil) li = list(new_li) print(li) filter():过滤 li1=[11,22,33,44] def fuc(x): if x>22: return True else: return False new_li=filter(fuc,li1) print(list(new_li))
学习条件运算时,对于简单的 if else 语句,可以使用三元运算来表示,即:
# 普通条件语句 if 1 == 1: name = ‘wupeiqi‘ else: name = ‘alex‘ # 三元运算 name = ‘wupeiqi‘ if 1 == 1 else ‘alex‘ 对于简单的函数,也存在一种简便的表示方式,即:lambda表达式 # ###################### 普通函数 ###################### # 定义函数(普通方式) def func(arg): return arg + 1 # 执行函数 result = func(123) # ###################### lambda ###################### # 定义函数(lambda表达式) my_lambda = lambda arg : arg + 1 # 执行函数 result = my_lambda(123) lambda存在意义就是对简单函数的简洁表示
open函数,该函数用于文件处理
操作文件时,一般需要经历如下步骤:
一、打开文件
1
|
文件句柄 = open ( ‘文件路径‘ , ‘模式‘ ) |
打开文件时,需要指定文件路径和以何等方式打开文件,打开后,即可获取该文件句柄,日后通过此文件句柄对该文件操作。
打开文件的模式有:
"+" 表示可以同时读写某个文件
"U"表示在读取时,可以将 \r \n \r\n自动转换成 \n (与 r 或 r+ 模式同使用)
"b"表示处理二进制文件(如:FTP发送上传ISO镜像文件,linux可忽略,windows处理二进制文件时需标注)
1 复制代码 2 3 class TextIOWrapper(_TextIOBase): 4 """ 5 Character and line based layer over a BufferedIOBase object, buffer. 6 7 encoding gives the name of the encoding that the stream will be 8 decoded or encoded with. It defaults to locale.getpreferredencoding(False). 9 10 errors determines the strictness of encoding and decoding (see 11 help(codecs.Codec) or the documentation for codecs.register) and 12 defaults to "strict". 13 14 newline controls how line endings are handled. It can be None, ‘‘, 15 ‘\n‘, ‘\r‘, and ‘\r\n‘. It works as follows: 16 17 * On input, if newline is None, universal newlines mode is 18 enabled. Lines in the input can end in ‘\n‘, ‘\r‘, or ‘\r\n‘, and 19 these are translated into ‘\n‘ before being returned to the 20 caller. If it is ‘‘, universal newline mode is enabled, but line 21 endings are returned to the caller untranslated. If it has any of 22 the other legal values, input lines are only terminated by the given 23 string, and the line ending is returned to the caller untranslated. 24 25 * On output, if newline is None, any ‘\n‘ characters written are 26 translated to the system default line separator, os.linesep. If 27 newline is ‘‘ or ‘\n‘, no translation takes place. If newline is any 28 of the other legal values, any ‘\n‘ characters written are translated 29 to the given string. 30 31 If line_buffering is True, a call to flush is implied when a call to 32 write contains a newline character. 33 """ 34 def close(self, *args, **kwargs): # real signature unknown 35 关闭文件 36 pass 37 38 def fileno(self, *args, **kwargs): # real signature unknown 39 文件描述符 40 pass 41 42 def flush(self, *args, **kwargs): # real signature unknown 43 刷新文件内部缓冲区 44 pass 45 46 def isatty(self, *args, **kwargs): # real signature unknown 47 判断文件是否是同意tty设备 48 pass 49 50 def read(self, *args, **kwargs): # real signature unknown 51 读取指定字节数据 52 pass 53 54 def readable(self, *args, **kwargs): # real signature unknown 55 是否可读 56 pass 57 58 def readline(self, *args, **kwargs): # real signature unknown 59 仅读取一行数据 60 pass 61 62 def seek(self, *args, **kwargs): # real signature unknown 63 指定文件中指针位置 64 pass 65 66 def seekable(self, *args, **kwargs): # real signature unknown 67 指针是否可操作 68 pass 69 70 def tell(self, *args, **kwargs): # real signature unknown 71 获取指针位置 72 pass 73 74 def truncate(self, *args, **kwargs): # real signature unknown 75 截断数据,仅保留指定之前数据 76 pass 77 78 def writable(self, *args, **kwargs): # real signature unknown 79 是否可写 80 pass 81 82 def write(self, *args, **kwargs): # real signature unknown 83 写内容 84 pass 85 86 def __getstate__(self, *args, **kwargs): # real signature unknown 87 pass 88 89 def __init__(self, *args, **kwargs): # real signature unknown 90 pass 91 92 @staticmethod # known case of __new__ 93 def __new__(*args, **kwargs): # real signature unknown 94 """ Create and return a new object. See help(type) for accurate signature. """ 95 pass 96 97 def __next__(self, *args, **kwargs): # real signature unknown 98 """ Implement next(self). """ 99 pass 100 101 def __repr__(self, *args, **kwargs): # real signature unknown 102 """ Return repr(self). """ 103 pass 104 105 buffer = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 106 107 closed = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 108 109 encoding = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 110 111 errors = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 112 113 line_buffering = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 114 115 name = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 116 117 newlines = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 118 119 _CHUNK_SIZE = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 120 121 _finalizing = property(lambda self: object(), lambda self, v: None, lambda self: None) # default 122 123 好文要顶 关注我 收藏该文
标签:
原文地址:http://www.cnblogs.com/dahuige/p/5181921.html