title: How to replace word in txt file
body: <p>Ok, so basically I'm making a simple game which involves a highscore.
  I would like the highscore to be saved if bigger than the previous highscore.
  This is my code. I have a few different errors, some involving the fact that I'm switching between strings and integers and other errors because my code is plain wrong. I gave it quite a shot to try and understand the problem but new errors seem to keep coming. </p>
  
  <pre><code>hisc = open("Hscore.txt", "r+")
  hiscore = hisc.read(3) # 3 because the max score would never reach 1000
  highscore = int(hiscore)
  if score &gt; highscore:
      hiscore = hiscore.replace(hiscore, score)
      hisc.write(hiscore)
  </code></pre>
  
  <p>This was my last attempt at this. It could be 100% wrong, i made my best effort.
  What I need is so that whenever I run the game it shows my high score. If my score is larger than my highscore, the highscore in the text file is changed. It s then reloaded into the game to act again in this code. </p>