title: Looping over lines with Python
body: <p>So I have a file that contains this:</p>
  
  <pre><code>SequenceName 4.6e-38 810..924
  SequenceName_FGS_810..924 VAWNCRQNVFWAPLFQGPYTPARYYYAPEEPKHYQEMKQCFSQTYHGMSFCDGCQIGMCH
  SequenceName 1.6e-38 887..992
  SequenceName_GYQ_887..992 PLFQGPYTPARYYYAPEEPKHYQEMKQCFSQTYHGMSFCDGCQIGMCH
  </code></pre>
  
  <p>I want my program to read only the lines that contain these protein sequences. Up until now I got this, which skips the first line and read the second one:</p>
  
  <pre><code>handle = open(filename, "r")
  handle.readline()
  linearr = handle.readline().split()
  handle.close()
  
  fnamealpha = fname + ".txt"
  handle = open(fnamealpha, "w")
  handle.write("&gt;%s\n%s\n" % (linearr[0], linearr[1]))
  handle.close()
  </code></pre>
  
  <p>But it only processes the first sequence and I need it to process every line that contains a sequence, so I need a loop, how can I do it?
  The part that saves to a txt file is really important too so I need to find a way in which I can combine these two objectives.
  My output with the above code is:</p>
  
  <pre><code>&gt;SequenceName_810..924
  VAWNCRQNVFWAPLFQGPYTPARYYYAPEEPKHYQEMKQCFSQTYHGMSFCDGCQIGMCH
  </code></pre>