title: String search and write into a file in jython
body: <p>I wish to write a program that can read a file and if a particular str_to_find is found in a bigger string, say
    "AACATGCCACCTGAATTGGATGGAATTCATGCGGGACACGCGGATTACACCTATGAGCAGAAATACGGCCTGCGCGATTACCGTGGCGGTGGACGTTCTTCCGCGCGTGAAACCGCGATGCGCGTAGCGGCAGGGGCGATCGCCAAGAAATACCTGGCGGAAAAGTTCGGCATCGAAATCCGCGGCTGCCTGACCCAGATGGGCGACATTCCGCTGGAGATTAAAGACTGGCGTCAGGTTGAGCTTAATCCGTTTTC"</p>
  
  <p>then  write that <strong>line and the above line of it</strong> into the file and keep repeating it for all the match found. </p>
  
  <p>Please suggest the solution. I have written the program for printing that particular search line but I don't know how to write the above line. </p>
  
  <pre><code>import re
  import string
  file=open('C:/Users/Administrator/Desktop/input.txt','r')
  output=open('C:/Users/Administrator/Desktop/output.txt','w')
  count_record=file.readline()
  str_to_find='AACCATGC'
  while count_record:
   if  string.find(list,str_to_find) ==0:
    output.write(count_record)
  file.close()
  output.close()
  </code></pre>