title: How to write to .txt files in Python 3
body: <p>I have a <code>.txt</code> file in the same folder as this <code>.py</code> file and it has this in it:</p>
  
  <pre><code>cat\n
  dog\n
  rat\n
  cow\n
  </code></pre>
  
  <p>How can I save a var (var = 'ant') to the next line of the <code>.txt</code> file?</p>