title: Write three columns of file to new text file using python
body: <p>I am reading data from a big .gtf file. Here is the code for it:</p>
  
  <pre><code>fname="gencode.v19.annotation.gtf"
  
  
  for line in open(fname,'r'):
      if not line.startswith('##'):
          col1=line.split()[0]
          col3=line.split()[2]
          col4=line.split()[3]
          col5=line.split()[4]
          if "protein_coding" in line and col3=="exon":
              data = col1,col4,col5
              results=list(data)
              print(results)
  
  
  dataFile = open('results.txt','w')
  
  for list in results:
      dataFile.writelines(results)
  
  dataFile.close()
  </code></pre>
  
  <p>The results that print out in IDLE look like this:</p>
  
  <pre><code>['chr1', '120461029', '120461176']
  ['chr1', '120460288', '120460385']
  ['chr1', '120454176', '120459317']
  ['chr1', '120466260', '120466528']
  ['chr1', '120465118', '120465401']
  ['chr1', '120479905', '120480086']
  ['chr1', '120477890', '120478227']
  ['chr1', '120611948', '120612240']
  ['chr1', '120547952', '120548211']
  </code></pre>
  
  <p>(but there are a TON of them....)</p>
  
  <p>My question is, why is my current code not working to print all my data into the new text file? How should I write the code so that it doesn't print the whole thing first and THEN import it to the new file? How can I have it import to the new text file automatically?</p>
  
  <p>Any help at all would be EXTREMELY appreciated! Thank you!</p>