title: Invalid literal for int() with base 10: ' ', reading off text file
body: <p>Im trying to make a text game/rpg in python. Im getting an</p>
  
  <blockquote>
    <p>line 89, in 
        surv = int(statload.readline(3))</p>
    
    <p>ValueError: invalid literal for int() with base 10: ''</p>
  </blockquote>
  
  <p>error code, when trying to read off a file. the other ones around it read fine.</p>
  
  <p>Reading code-</p>
  
  <pre><code>statload = open("Statsheet.txt","r")  
  luck = int(statload.readline(2))
  surv = int(statload.readline(3))
  statload.close
  </code></pre>
  
  <p>Code which Writes to file-</p>
  
  <pre><code>stats = open("Statsheet.txt","w")
  stats.write(repr(luck)+ "\n")
  stats.write(repr(surv)+ "\n")
  stats.close
  </code></pre>
  
  <p>Contents of Text File-</p>
  
  <pre><code>45
  40
  </code></pre>
  
  <p>I have to have the "luck" and "surv" stats in "int" format, as later on in the code they are used in mathematical functions. The modules i have imported are "sys", "time", "random", and "math", if that helps at all.</p>
  
  <p>Edit- will put variables into a JSON file instead, as one user suggested, and now know that the "readline" reads the bit value. thanks!</p>