摘要: 作用:配置文件解析模块,用来增删改查配置文件内容,不区分大小写 配置文件案例: tets.ini [模块] key=value import configparser config = configparse.configParser()查询:config.read('test.ini') 读取配置 阅读全文
posted @ 2020-04-13 01:24 轰天雷 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 配置文件: 参考https://www.redis.net.cn/tutorial/3504.html 数据类型: string、hash(字典)、set、zset、list 备份和恢复: 通过aof和rdb文件进行备份和恢复,aof类似于数据库的binlog,数据恢复较完整,rdb属于定期完整备份 阅读全文
posted @ 2020-04-12 11:46 轰天雷 阅读(155) 评论(0) 推荐(0) 编辑
摘要: tcpdump采用命令行方式,它的命令格式为:tcpdump [ -adeflnNOpqStvx ] [ -c 数量 ] [ -F 文件名 ] [ -i 网络接口 ] [ -r 文件名] [ -s snaplen ] [ -T 类型 ] [ -w 文件名] [表达式 ] tcpdump的选项介绍:- 阅读全文
posted @ 2020-04-12 11:19 轰天雷 阅读(1022) 评论(0) 推荐(0) 编辑
摘要: 1、split分割文件 split -C50m error.log nginx_erro 按文件大小进行分割nginx_erro是新的文件名前缀 split -l1000 error.log nginx_erro 按文件行数进行分割 阅读全文
posted @ 2020-04-12 11:01 轰天雷 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 语法 find path -option [ -print ] [ -exec -ok command ] {} \; 参数说明 : find 根据下列规则判断 path 和 expression,在命令列上第一个 - ( ) , ! 之前的部份为 path,之后的是 expression。如果 p 阅读全文
posted @ 2020-04-12 10:38 轰天雷 阅读(129) 评论(0) 推荐(0) 编辑
摘要: XML模块:(用到的时候再看)tree=xml.parse('xmltest.xml')root= tree.getroot()print(root.tag) 打印对象的标签root.attrib 获取对象的属性root.text 获取对象的文本内容 RE模块:re.findall("匹配条件"," 阅读全文
posted @ 2020-04-12 00:47 轰天雷 阅读(144) 评论(0) 推荐(0) 编辑
摘要: OS模块: os.getcwd()获取当前路径os.chdir()改变目录os.curdir返回当前目录os.pardir()父目录os.makedirs('a/b/c')创建多层目录os.removedirs()删除多层目录中的空目录os.mkdir()创建目录os.listdir()列出文件夹下 阅读全文
posted @ 2020-04-11 20:25 轰天雷 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 1、持续输入数据、输完之后退出 with open('test4.txt','w',encoding='utf-8') as f: while True: inp = input("请输入内容:") if inp == 'q': break f.write(inp + '\n') with open 阅读全文
posted @ 2020-04-11 09:54 轰天雷 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 定义: 模块是一组Python代码的集合,可以使用其他模块,也可以被其他模块使用。 重点: 1、模块的名字不要和自带的模块名字相同,不然会优先调用自己的那个模块,因为查找模块的时候是按照sys.path()的路径查找的(time,sys模块除外),可以使用import 模块先测试下名字是否有冲突 2 阅读全文
posted @ 2020-04-10 01:08 轰天雷 阅读(144) 评论(0) 推荐(0) 编辑
摘要: f.read(3)代表读取3个字符,如果是b模式打开的文件,则是读取三个字节f.flush将文件从内存刷到硬盘f.closeed文件如果关闭则返回Truef.encoding查看使用open打开文件的编码 tell查看光标位置seek移动光标truncate截断文件 0模式,从开头开始移动光标位置, 阅读全文
posted @ 2020-04-07 23:40 轰天雷 阅读(87) 评论(0) 推荐(0) 编辑