上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 55 下一页
摘要: LV扩容 一、 LVM概述 在 Linux 系统中,我们经常使用 LVM (逻辑卷管理)的方式去管理和使用磁盘, LVM 可以动态扩容,给我们的使用带来了很多的便捷性 LVM结构图如下: image.png 物理卷(Physical Volume,PV) 指磁盘分区或从逻辑上与磁盘分区具有同样功能的 阅读全文
posted @ 2020-10-10 14:49 ascertain 阅读(982) 评论(0) 推荐(0) 编辑
摘要: shell中 ! 叫做事件提示符,Event Designator,可以方便的引用历史命令,即history中记录的命令 !n 引用第n条命令 !-n 引导倒数第n条命令, !-1 引用倒数第一条命令 !! 同 !-1 !string 引用最近以string开始的命令 !$ 传递最后执行的命令参数 阅读全文
posted @ 2020-10-09 21:28 ascertain 阅读(572) 评论(0) 推荐(0) 编辑
摘要: return 返回的是状态码, return不返回函数返回值 可以在前面用 echo 返回函数返回值,return 返回指定函数退出状态码 echo 返回的是函数返回值,如果没有使用return,则函数退出状态码是函数最后一条命令的退出状态码 return后面的语句将不再执行 #!/bin/bash 阅读全文
posted @ 2020-10-09 20:58 ascertain 阅读(1161) 评论(0) 推荐(0) 编辑
摘要: 自定义keyfile: 路径必须位于/etc/NetworkManager/system-connections/*.nmconnection This file must be owned by root and be readably only by root - otherwise Netwo 阅读全文
posted @ 2020-10-09 11:19 ascertain 阅读(5429) 评论(0) 推荐(0) 编辑
摘要: 查看模块的内容dir(functools) 阅读全文
posted @ 2020-10-08 23:23 ascertain 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 错误Error: 逻辑错误: 算法错误, - => + 笔误: 变量名错误,语法错误 函数或类使用错误 错误可以避免 异常Exception: 本身就是意外情况 前提时没有出现上面的错误,即程序写的没有问题,但是某些情况下,会出现一些意外,导致程序无法正常执行下去 open函数操作一个文件,文件不存 阅读全文
posted @ 2020-10-08 18:55 ascertain 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 将正索引从1迭代,取负正好为负索引 阅读全文
posted @ 2020-10-08 18:37 ascertain 阅读(176) 评论(0) 推荐(0) 编辑
摘要: class Property: def __init__(self,fget=None,fset=None,fdel=None): self.fget=fget self.fset=fset self.fdel=fdel def __repr__(self): return 'self: {} fg 阅读全文
posted @ 2020-10-08 18:02 ascertain 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 借助list class SimplexNode: def __init__(self,item,prev=None,post=None): self.item=item self.prev=None self.post=None def __repr__(self): # return 'item 阅读全文
posted @ 2020-10-08 15:34 ascertain 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 实现StaticMethod,完成staticmethod装饰器功能 实现ClassMethod,完成classmethod装饰器功能 class StaticMethod: def __init__(self,fn): print('StaticMethod Init') self.fn=fn d 阅读全文
posted @ 2020-10-07 22:54 ascertain 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 运行时,区别于编译时,指的是程序被加载到内存中执行的时候 反射,reflection,指的是运行时获取类型定义的信息 一个对象能够在运行时,像找镜子一样,反射处其类型信息 在Python中,能够通过一个对象,找出其type,class,attribute,method的能力,称为反射或自省 具有反射 阅读全文
posted @ 2020-10-07 12:59 ascertain 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 文件I/O操作可以对文件对象使用上下文管理,使用with as语法 with open('file') as f: pass 上下文管理对象 当一个对象同时实现了__enter__()和__exit__()方法,就属于上下文管理对象 __enter__进入与此对象相关的上下文,如果存在该方法,wit 阅读全文
posted @ 2020-10-06 20:06 ascertain 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 类思想实现 class Fabonacci: def __init__(self): self.b=[1,1] # 缓存计算结果 def __call__(self,p): if p <= len(self.b): # 判断是否已经计算过 return self.b[p-1] for v in ra 阅读全文
posted @ 2020-10-06 15:46 ascertain 阅读(160) 评论(0) 推荐(0) 编辑
摘要: def vix(): print(vix.__module__,vix.__name__) vix() == vix.__call__() 对象vix加上(),就是调用对象的__call__()方法 定义一个类,实例化得到实例,将实例像函数一样调用 def viz(*args): print(arg 阅读全文
posted @ 2020-10-06 02:24 ascertain 阅读(90) 评论(0) 推荐(0) 编辑
摘要: __len__内建函数len(),返回对象的长度(>=0),把对象当作容器类型看,如同list或dict,bool()函数调用的时候,如果没有__bool__()方法,则会看__len__()方法是否存在,存在返回非0为真 __iter__ 迭代容器时调用,返回一个新的迭代器对象 __contain 阅读全文
posted @ 2020-10-06 01:09 ascertain 阅读(107) 评论(0) 推荐(0) 编辑
摘要: operator模块提供一下特殊方法,可以将类的实例使用下面的操作符来操作 运算符 特殊方法 含义 <,<=,==,>,>=,!= __lt__,__le__,__eq__,__gt__,__ge__,__ne__ 比较运算符 +,-,*,/,%,//,**,divmod __add__,__sub 阅读全文
posted @ 2020-10-05 23:22 ascertain 阅读(97) 评论(0) 推荐(0) 编辑
摘要: __bool__ 内建函数bool(),或者对象放在逻辑表达式的位置,调用这个函数返回布尔值,没有定义__bool__(),就找__len__()返回长度,非0为真,如果__len__()也没有定义,所有实例都返回真 class B:pass print(bool(B())) class C: de 阅读全文
posted @ 2020-10-05 17:41 ascertain 阅读(98) 评论(0) 推荐(0) 编辑
摘要: __hash__: 内建函数hash()调用的返回值,返回一个整数,如果定义这个方法该类的实例就可hash class M: b=899 def __init__(self): self.hy=44 pass def __hash__(self): return 89 # __hash__=None 阅读全文
posted @ 2020-10-05 16:00 ascertain 阅读(238) 评论(0) 推荐(0) 编辑
摘要: __name__ 类,函数,方法的名字 __module__ 类,函数,方法所在的模块名 __class__ 类,对象,函数所属的类所有的函数和方法均属于<class 'function'> def bnm():pass class P: def uo(self):pass print(bnm.__ 阅读全文
posted @ 2020-10-05 14:18 ascertain 阅读(196) 评论(0) 推荐(0) 编辑
摘要: p='''bottle\r\nbag\r\nbig\napple''' import re regex=re.compile(r'\bb(?P<middle>\w)(?P<tail>g)') mat=regex.finditer(p) print(mat) for m in mat: print(m 阅读全文
posted @ 2020-10-05 13:51 ascertain 阅读(1173) 评论(0) 推荐(0) 编辑
上一页 1 ··· 37 38 39 40 41 42 43 44 45 ··· 55 下一页