时间:2021-05-22
本文实例讲述了python简单文本处理的方法。分享给大家供大家参考。具体如下:
由于有多线程的影响,c++项目打印出来的时间顺序不一致,导致不太好在excel中统计,故使用python写了段脚本来解决之。涉及到如下方面
1. txt文本的读取,utf8的处理
2. 字符串的基本操作
3. dict的基本操作
4. list(数组)的基本操作
log.txt文件如下:
enter OpenNextImage at 5124D:\pics\测试图片\解码性能对比用图\jpeg\较小图\2.JPGenter OpenImage at 5124In OpenImage send On_ImageRefresh at 5124enter LoadImage at 5124leave OpenImage at 5124leave OpenNextImage at 5124decode began at 5124enter DrawClient at 5140leave DrawClient at 5155decode end at 5265in LoadImage send On_ImageRefresh at 5265leave loadImage at 5265enter DrawClient at 5280leave DrawClient at 5327==================================================================================enter OpenNextImage at 6280D:\pics\测试图片\解码性能对比用图\jpeg\较小图\3.JPGenter OpenImage at 6280In OpenImage send On_ImageRefresh at 6280enter LoadImage at 6280leave OpenImage at 6296leave OpenNextImage at 6296decode began at 6296enter DrawClient at 6296leave DrawClient at 6312decode end at 6437in LoadImage send On_ImageRefresh at 6437enter DrawClient at 6437leave loadImage at 6452leave DrawClient at 6499==================================================================================enter OpenNextImage at 7265D:\pics\测试图片\解码性能对比用图\jpeg\较小图\4.JPGenter OpenImage at 7265In OpenImage send On_ImageRefresh at 7265leave OpenImage at 7265leave OpenNextImage at 7265enter LoadImage at 7265decode began at 7265enter DrawClient at 7265leave DrawClient at 7296decode end at 7421in LoadImage send On_ImageRefresh at 7421enter DrawClient at 7421leave loadImage at 7437leave DrawClient at 7483==================================================================================enter OpenNextImage at 8062D:\pics\测试图片\解码性能对比用图\jpeg\较小图\5.JPGenter OpenImage at 8062In OpenImage send On_ImageRefresh at 8062leave OpenImage at 8062leave OpenNextImage at 8062enter LoadImage at 8062decode began at 8062enter DrawClient at 8062leave DrawClient at 8077decode end at 8202in LoadImage send On_ImageRefresh at 8202enter DrawClient at 8202leave DrawClient at 8265leave loadImage at 8280==================================================================================enter OpenNextImage at 8811D:\pics\测试图片\解码性能对比用图\jpeg\较小图\6.JPGenter OpenImage at 8811In OpenImage send On_ImageRefresh at 8811leave OpenImage at 8811leave OpenNextImage at 8811enter LoadImage at 8811decode began at 8811enter DrawClient at 8811leave DrawClient at 8843decode end at 8968in LoadImage send On_ImageRefresh at 8968leave loadImage at 8968enter DrawClient at 8968leave DrawClient at 9030==================================================================================enter OpenNextImage at 9515D:\pics\测试图片\解码性能对比用图\jpeg\较小图\7.JPGenter OpenImage at 9515In OpenImage send On_ImageRefresh at 9515leave OpenImage at 9515leave OpenNextImage at 9515enter LoadImage at 9515decode began at 9530enter DrawClient at 9530leave DrawClient at 9546decode end at 9671in LoadImage send On_ImageRefresh at 9671enter DrawClient at 9671leave loadImage at 9671leave DrawClient at 9733==================================================================================enter OpenNextImage at 10171D:\pics\测试图片\解码性能对比用图\jpeg\较小图\8.JPGenter OpenImage at 10171In OpenImage send On_ImageRefresh at 10171leave OpenImage at 10171leave OpenNextImage at 10171enter LoadImage at 10171decode began at 10186enter DrawClient at 10186leave DrawClient at 10202decode end at 10311in LoadImage send On_ImageRefresh at 10311leave loadImage at 10311enter DrawClient at 10311leave DrawClient at 10374==================================================================================enter OpenNextImage at 10811D:\pics\测试图片\解码性能对比用图\jpeg\较小图\9.JPGenter OpenImage at 10811In OpenImage send On_ImageRefresh at 10811enter LoadImage at 10811leave OpenImage at 10811leave OpenNextImage at 10811enter DrawClient at 10811decode began at 10811leave DrawClient at 10843decode end at 10952in LoadImage send On_ImageRefresh at 10952leave loadImage at 10952enter DrawClient at 10952leave DrawClient at 11030==================================================================================enter OpenNextImage at 11452D:\pics\测试图片\解码性能对比用图\jpeg\较小图\10.JPGenter OpenImage at 11452In OpenImage send On_ImageRefresh at 11452leave OpenImage at 11452leave OpenNextImage at 11452enter LoadImage at 11452decode began at 11452enter DrawClient at 11468leave DrawClient at 11483decode end at 11593in LoadImage send On_ImageRefresh at 11593enter DrawClient at 11593leave loadImage at 11608leave DrawClient at 11655==================================================================================enter OpenNextImage at 12077enter DrawClient at 12077leave DrawClient at 12108==================================================================================enter OpenNextImage at 13124D:\pics\测试图片\解码性能对比用图\jpeg\较小图\1.jpgenter OpenImage at 13124In OpenImage send On_ImageRefresh at 13124leave OpenImage at 13124leave OpenNextImage at 13124enter LoadImage at 13124decode began at 13124enter DrawClient at 13139leave DrawClient at 13155decode end at 13358in LoadImage send On_ImageRefresh at 13358leave loadImage at 13358enter DrawClient at 13358leave DrawClient at 13405==================================================================================希望本文所述对大家的Python程序设计有所帮助。
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
grep、sed和awk都是文本处理工具,虽然都是文本处理工具但却都有各自的优缺点,一种文本处理命令是不能被另一个完全替换的,否则也不会出现三个文本处理命令了。
从学习Python至今,发现很多时候是将Python作为一种工具。特别在文本处理方面,使用起来更是游刃有余。说到文本处理,那么正则表达式必然是一个绝好的工具,它
学习linux的同人,都知道linuxshell文本处理能力非常强大。有一组强大的文本处理工具:grep,sed,awk。其中grep经常用作查找匹配文本、se
今天,来介绍几个常用文本处理命令和vim文本编辑器day3--常用文本处理命令和vim文本编辑器 col,用于过滤控制字符,-b过滤掉所有控制字符,这个命令并
这篇文章主要介绍了Python文本处理简单易懂方法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下自从认识