Python Replace one line in >20GB text file
问题 I am fully aware that there were many approaches to this problem. What I need is a simple Python script that would replace only 1 line in a large text file. It is always the fourth line from the beginning. As the file (actually, files) is bigger than 20GB, I don't want to load it to memory or create a copy, just replace one line efficiently. I'll be glad for any help in this regard. A. PS. I know vi can do it, but I need it as a script, so that someone non-vi-compatible would be able to do it