title: How to open a file in both read and append mode at the same time in one variable in python?
body: <p><code>'r'</code> will read a file, <code>'w'</code> will write text in the file from the start, and <code>'a'</code> will append. How can I open the file to read and append at the same time?</p>
  
  <p>I tried these, but got errors:</p>
  
  <pre><code>open("filename", "r,a")
  
  open("filename", "w")
  open("filename", "r")
  open("filename", "a")
  </code></pre>
  
  <p>error:</p>
  
  <pre><code>invalid mode: 'r,a'
  </code></pre>