title: How to efficiently append a new line to the starting of a large file?
body: <p>I want to append a new line in the starting of 2GB+ file. I tried following code but code OUT of MEMORY 
   error.</p>
  
  <pre><code>myfile = open(tableTempFile, "r+")
  myfile.read() # read everything in the file
  myfile.seek(0) # rewind
  myfile.write("WRITE IN THE FIRST LINE ")
  myfile.close();
  </code></pre>
  
  <ol>
  <li>What is the way to write in a file file without getting the entire file in memory?</li>
  <li>How to append a new line at starting of the file?</li>
  </ol>