文件大概有80个G大小,想用多线程,我知道可以用f.seek()去设置偏移,以达到从不同的位置开始读入的效果
可是应该如何给每个线程分配一个合适偏移?
with open(r'file.txt', 'rb') as f:
for line in f:
dosomething(line)
PHP中文网2017-04-18 10:04:32
You can split large files now, and then multi-thread the split small files: http://www.jb51.net/article/5...