Python 改变字体颜色
摘要:格式:\033[显示方式;前景色;背景色m 说明:前景色 背景色 颜色 30 40 黑色31 41 红色32 42 绿色33 43 黃色34 44 蓝色35 45 紫红色36 46 青蓝色37 47 白色显示方式 意义 0 终端默认设置1 高亮显示4 使用下划线5 闪烁7 反白显示8 不可见 例子:
阅读全文
posted @
2016-06-17 00:08
Alex0425
阅读(1053)
推荐(0)
Python logging模块
摘要:将日志直接输出到屏幕 Sat, 04 Jun 2016 10:17:25 log_m.py[line:16] INFO This is info messageSat, 04 Jun 2016 10:17:25 log_m.py[line:17] WARNING This is warn messa
阅读全文
posted @
2016-06-04 16:11
Alex0425
阅读(201)
推荐(0)
Python subprocess模块
摘要:subprocess模块提供进程间操作 call方法创建一个子进程 在Linux下,shell=False时, Popen调用os.execvp()执行args指定的程序;shell=True时,如果args是字符串,Popen直接调用系统的Shell来执行args指定的程序,如果args是一个序列
阅读全文
posted @
2016-06-03 17:23
Alex0425
阅读(189)
推荐(0)
Python hashlib模块
摘要:应用场景:注册、登录、文件上传、相册加密.... hash.update(arg) 更新哈希对象以字符串参数,如果同一个hash对象重复调用该方法,则m.update(a); m.update(b) is equivalent to m.update(a+b). hash.digest() 返回摘要
阅读全文
posted @
2016-06-03 15:28
Alex0425
阅读(111)
推荐(0)
Python configparser模块
摘要:import configparser conf = configparser.ConfigParser() conf.read("test.cfg") sections = conf.sections() print (sections)['sec_c', 'sec_b', 'sec_a'] options = conf.options("sec_a") print (options) kv...
阅读全文
posted @
2016-06-03 11:35
Alex0425
阅读(196)
推荐(0)
Python OS,shutil模块
摘要:os.popen().read() 获取目录的结果 shutil模块用于对文件,文件夹,压缩包的处理 glob.glob函数用于查找符合要求的目的模块,其中[]表示匹配里面的字符,*表示0个或一个字符,?表示一个字符 查看文件属性的自定义函数 make_archive函数的使用
阅读全文
posted @
2016-06-01 00:01
Alex0425
阅读(390)
推荐(0)