title: What is the exact difference between r+ and w+ modes?
body: <p>I tried to use both of them opening a file but got the same result. </p>
  
  <p><code>w+</code> is supposed to create a new file if it doesn't exist while <code>r+</code> not. 
  <strong>Is this the only difference?</strong></p>
  
  <p>For example, this is an <strong>initial file <code>file.txt</code></strong></p>
  
  <pre><code>Line 1
  Line 2
  Line 3
  </code></pre>
  
  <p>1) <strong><code>file.txt</code></strong> after implementing of <strong><code>r+</code> mode</strong> (writing the word "hello")</p>
  
  <pre><code>hello
  </code></pre>
  
  <p>2) <strong><code>file.txt</code></strong> after implementing of <strong><code>w+</code></strong> <strong>mode</strong></p>
  
  <pre><code>hello
  </code></pre>
  
  <p>I guessed that <code>r+</code> would append an input to the beginning of the file.</p>
  
  <p>EDITED:
  So, the 1st difference is about creating a file that doesn't exist and the 2nd difference is that r+ overwrites while w+ truncates, right? (than the question arises whether overwriting and truncating are the same concepts or not) </p>