xieranmaya
2014-07-05 11:52:08 +08:00
才50万行,一边读一边写,用py啊,分分钟就ok了。
我做过5万多行的,需求跟你一模一样,不过一行特别长,文件总大小100M+,几秒钟就搞定了
还有py代码呢,我来找找
import os
import sys
import platform
print(platform.python_version())
lpf = 4000 # line per file
bigfile = open('bigfile.txt',encoding='utf8')
part = 10 # 为了文件名长度一致
while True:
parts = open(str(part)+'.dat','w',encoding='utf8')
part += 1
for i in range(0,lpf):
line = bigfile.readline()
if not line:
parts.close()
bigfile.close()
sys.exit()
parts.write(line)
parts.close()
bigfile.close()