title: built-in function in Python to check Header in a Text file
body: <p>I wish to check if in a text file of points (x,y,z, etc) where is an <strong><em>header (True)</em></strong> or <strong><em>not (False)</em></strong>. I wish to know if there is a built-in function in Python or a better method respect my own function.</p>
  
  <pre><code>def check_header(filename, parse):
      with open(filename) as f:
          first = f.readline()
          line = first.rstrip().split(parse)
          try:
              float(line[0])
              return False
          except ValueError:
              return True
  </code></pre>
  
  <p>i wrote this function 
  example</p>
  
  <pre><code>a b c d
  449628.46 6244026.59 0.47 1
  449628.55 6244033.12 0.30 2 
  449628.75 6244046.31 0.37 3 
  449628.81 6244049.63 0.44 1 
  449628.81 6244049.88 0.39 5 
  449628.81 6244050.66 0.30 1 
  449628.96 6244060.67 0.38 2 
  449629.18 6244075.61 0.39 2 
  449629.24 6244078.72 0.47 4 
  449629.24 6244078.96 0.41 8 
  449629.23 6244079.19 0.34 4 
  
  check_header(filename, " ")
  True
  
  449628.46 6244026.59 0.47 1
  449628.55 6244033.12 0.30 2 
  449628.75 6244046.31 0.37 3 
  449628.81 6244049.63 0.44 1 
  449628.81 6244049.88 0.39 5 
  449628.81 6244050.66 0.30 1 
  449628.96 6244060.67 0.38 2 
  449629.18 6244075.61 0.39 2 
  449629.24 6244078.72 0.47 4 
  449629.24 6244078.96 0.41 8 
  449629.23 6244079.19 0.34 4
  
  check_header(filename, " ")
  False 
  </code></pre>