title: What's the difference between 'r+' and 'a+' when open file in python?
body: <p>I have try <code>r+</code> and <code>a+</code> to open file and read and write, but 'r+' and 'a+' are all append the str to the end of the file.</p>
  
  <p>So, what's the difference between <code>r+</code> and <code>a+</code> ?</p>
  
  <hr>
  
  <p>Add:</p>
  
  <p>I have found the reason: </p>
  
  <p>I have read the file object and forgot to seek(0) to set the location to the begin</p>