title: Python: Checking Header Format
body: <p>I'm new to python and need help with a problem. Basically I need to open a file and read it which I can do no problem. The problem arises at line 0, where I need to check the header format.</p>
  
  <p>The header needs to be in the format: <code>p wncf nvar nclauses hard</code>
  where 'nvar' 'nclauses' and 'hard' are all positive integers.</p>
  
  <p>For example:</p>
  
  <p><code>p wncf 1563 817439 186191</code></p>
  
  <p>would be a valid header line.</p>
  
  <p>Here is coding i have already thanks to a question people answered earlier:</p>
  
  <pre><code>import re 
  filename = raw_input('Please enter the name of the WNCF file: ') 
  f = open(filename, 'r') 
  
  for line in f: 
      p = re.compile('p wncf \d+ \d+ \d+$') 
      if p.match(line[0]) == None: 
          print "incorrect format"
  </code></pre>
  
  <p>I still get an incorrect format even when the file is of a correct format. Also, would it be possible to assign the integers to an object?</p>
  
  <p>Thanks in advance.</p>