title: How to write at a specific position of a file in Python
body: <p>I have a text file which writes <code>Hello, how are you? \n\n\n</code>.</p>
  
  <p>I would like to append <code>I am Sam.</code> with the last two <code>\n</code>s removed.</p>
  
  <p>The resultant sentence should be <code>Hello, how are you? \nI am Sam.</code></p>
  
  <p>How is this done in Python?</p>
  
  <p>Thanks</p>