title: Python output gets changed when using f.read and f.readline after writing in r+ mode
body: <p>I am using f.readline() and f.read() but both are generating different files in respect to pointer.
  One is starting from 0 and appending at last and the other replaces the text with</p>
  <p>This is the code with read</p>
  <pre><code>f = open('k.txt', 'w')
  
  f.write('I love python very much\n')
  
  f.write('Because of its vast community support\n')
  
  f.write('and huge inbuilt libs\n')
  
  f.close()
  
  
  f = open('k.txt', 'r+')
  
  f.write('I love coding at school but its covid now\n')
  
  #print(f.tell())
  
  print(f.read())
  
  f.close()
  
  </code></pre>
  <p>This is the second code with readline</p>
  <pre><code>
  f = open('k.txt', 'w')
  
  f.write('I love python very much\n')
  
  f.write('Because of its vast community support\n')
  
  f.write('and huge inbuilt libs\n')
  
  f.close()
  
  
  f = open('k.txt', 'r+')
  
  f.write('I love coding at school but its covid now\n')
  
  #print(f.tell())
  
  print(f.readline())
  
  f.close()
  
  </code></pre>
  <p>Can you tell why the pointer is behaving like that in both cases</p>