title: Is there a way to cast _io.TextIOWrapper to an integer in Python
body: <pre><code>f = open(&quot;example.txt&quot;, &quot;r&quot;)
  print(f.read())
  
  f = int(f)
  </code></pre>
  <p>i am trying to compare what is the document with a number e.g. in the document there is 4 and I want to compare it like this</p>
  <pre><code>if 5 &lt; f
  </code></pre>