title: Python - ignore lines in a file
body: <p>How does one ignore lines in a file?</p>
  <p>Example:</p>
  <p>If you know that the first lines in a file will begin with say, a or b and the remainder of lines end with c, how does one parse the file so that lines beginning a or b are ignored and lines ending c are converted to a nested list?</p>
  <p>What I have so far:</p>
  <pre><code>fname = raw_input('Enter file name: ')
  
  z = open(fname, 'r')
  
  #I tried this but it converts all lines to a nested list
  
  z_list = [i.strip().split() for i in z]
  </code></pre>
  <p>I am guessing that I need a for loop.</p>
  <pre><code>for line in z:
      if line[0] == 'a':
          pass
      if line[0] == 'b':
          pass
      if line[-1] == 'c':
          list_1 = [line.strip().split()]
  </code></pre>
  <p>The above is the general idea but I am expert at making dead code! How does one render it undead?</p>