title: How to update line of file in python
body: <p>How to update existing line of file in Python?</p>
  
  <p>Example: I want to update <code>session.xml</code> to <code>sesion-config.xml</code> without writing new line.</p>
  
  <p>Input <code>A.txt</code>:</p>
  
  <pre><code>fix-config = session.xml
  </code></pre>
  
  <p>Expected output <code>A.txt</code>:</p>
  
  <pre><code>fix-config = session-config.xml
  </code></pre>