Hi.
Suppose we have a very large file, and wanna remove 'n' bytes in the
middle of the file. My thought is:
1, read() until we reach the bytes should be removed, and mark the
position as 'pos'.
2, seek(tell() + n) bytes
3, read() until we reach the end of the file, into a variable, say 'a'
4, seek(pos) back to 'pos'
5, write(a)
6, truncate()

If the file is really large, the performance may be a problem.
Is there a clever way to finish? Could mmap() help? Thx

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to