文件大概有80个G大小,想用多线程,我知道可以用f.seek()去设置偏移,以达到从不同的位置开始读入的效果可是应该如何给每个线程分配一个合适偏移?
with open(r'file.txt', 'rb') as f: for line in f: dosomething(line)
学习是最好的投资!
You can split large files now, and then multi-thread the split small files: http://www.jb51.net/article/5...
Use the mmap module to read and write files like accessing memory.
You can split large files now, and then multi-thread the split small files: http://www.jb51.net/article/5...
Use the mmap module to read and write files like accessing memory.