title: replacing characters in existing large file
body: <p>i have a large file in my local disk which contains some fixed length string in first line. I need to programmatically replace that fixed length string using python without reading whole file in memory .</p>
  
  <p>i have tried opening the file in append mode and seeking to 0 position. And then replace the string which is of 9 bytes. The code is also added here , what i tried .</p>
  
  <pre><code>    with open ("largefile.txt", 'a') as f:
          f.seek(0,0)
          f.write("123456789")
  </code></pre>