title: Open/write deleting txt file contents?
body: <p>I am bassicly trying to read a number from a file, convert it to an int, add one to it,  then rewrite the new number back to the file. However every time I run this code when i open the .txt file it is blank. Any help would be appreciated thanks! I am a python newb.</p>
  
  <pre><code>f=open('commentcount.txt','r')
  counts = f.readline()
  f.close
  counts1 = int(counts)
  counts1 = counts1 + 1
  print(counts1)
  f2 = open('commentcount.txt','w') &lt;---(the file overwriting seems to happen here?)
  f2.write(str(counts1))
  </code></pre>