title: Python - Check Order of Lines in File
body: <p>How does one check the order of lines in a file?</p>
  
  <p>Example file:</p>
  
  <pre><code>a b c d e f
  b c d e f g
  1 2 3 4 5 0
  </code></pre>
  
  <p>Requirements:</p>
  
  <ol>
  <li>All lines beginning a, must precede lines beginning b.</li>
  <li>There is no limit on number of lines beginning a.</li>
  <li>Lines beginning a, may or may not be present.</li>
  <li>Lines containing integers, must follow lines beginning b.</li>
  <li>Numeric lines must have at least two integers followed by zero.</li>
  <li>Failure to meet conditions must raise error.</li>
  </ol>
  
  <p>I initially thought a rather long-winded for loop, but that failed as I am unable to index lines beyond line[0]. Also, I do not know how to define location of one line relative to the others. There is no limit on the length of these files so memory may also be an issue.</p>
  
  <p>Any suggestions very welcome! Simple and readable is welcome for this confused novice!</p>
  
  <p>Thanks,
  Seafoid.</p>