比如有一个文件a.txt内容大致如下:
情景一:
"1","12","123","123
4"
"A","AB","ABC","ABCD"
执行脚本后内容能够修改为
"1","12","123","1234"
"A","AB","ABC","ABCD"
情景二:
"1","12","123","
4"
"A","AB","ABC","ABCD"
执行脚本后内容能够修改为
"1","12","123","4"
"A","AB","ABC","ABCD"
情景三(出现于27L的这种情况属于正确的数据)
"1","12","123",
"A","AB","ABC",
能处理情景一、二、三的代码在19L
就算处理1.7G的测试文件依然很快,但是对于大于等于两个字段有换行符就不能处理了,虽然不会报错,比如下面
情景四:
"1","
12","12
3",,,
"1","12","123",,,
执行脚本后内容修改为
"1","12","123",,,
"1","12","123",,,
能处理情景一、二、三、四的代码在44L和57L
44L的bat+js代码无法处理测试用的文件1.7G,原因未知, win2003的兼容性目前未知
57L的python代码能处测试用的文件1.7G,耗时140s,这应该与机器性能有关,仅作参考
P.S:
1. PyInstaller打包的exe在2003上跑会有问题,老老实实装python的好
2. 本机(win7)装了python3.5_X64编译出来的代码在2003下怎么弄都有问题,2003换python2.7.10_X64可行。X86在读取大文件的时候会报错内存错误 |