title: Python: read the content of a text file and look for a match/condition
body: <p>I m trying to open up a text file and look for string <code>Num_row_lables</code>. If the value for <code>Num_row_labels</code> is greater than or equal to 10, then print the name of the file.</p>
  
  <p>In the example below, my text file <code>test.mrk</code> has some text in the format below: P.s., my text file doesn't have <code>Num_row_labels &gt;= 10</code>. It always has "<code>equal to</code>".</p>
  
  <pre><code>Format= { Window_Type="Tabular", Tabular= { Num_row_labels=10 } }
  </code></pre>
  
  <p>so I created a variable <code>teststring</code> to hold the pattern I will be looking at.
  Then I opened the file.</p>
  
  <p>Then using <code>re</code>, I got <code>Num_row_labels=10</code> in my variable called match.
  Using <code>group()</code> on match, I extracted the threshold number I wanted and using <code>int()</code> converted the <code>string to int</code>.</p>
  
  <p>My purpose is to read the text file to <code>find/print</code> the value for Num_row_labels along with the name of file if the text file has Num_row_labels = 10 or any # greater than 10.</p>
  
  <p>Here's my test code:</p>
  
  <pre><code>import os
  import os.path
  import re
  
  teststring = """Format= { Window_Type="Tabular", Tabular= { Num_row_labels=10 } }"""
  fname = "E:\MyUsers\ssbc\test.mrk"
  fo = open(fname, "r")
  match = re.search('Num_row_labels=(\d+)', teststring)
  tnum = int(match.group(1))
  
  
  if(tnum&gt;=10):
          print(fname) 
  </code></pre>
  
  <p>How do I make sure that I m searching the match in the content of opened file and checking the condition for tnum>=10? My test code would simply print the file name only on the basis of last 4 lines. I want to be sure that the search is all over the content of my text file.</p>