title: Writing only part of a line to a file
body: <p>I want to clean up my output and only write part of the line that I need to a new file and not the whole entire line. This is the relevent coding section:</p>
  
  <pre><code>counter = 1
  
  for line in completedataset:
      print counter
      counter +=1
  
      for t in matchedLines:
         if t in line[:line.find(',')]:
              smallerdataset.write(line)
              break
  </code></pre>
  
  <p>Here is a sample of the data:</p>
  
  <p>NOVE1780418","---","JAX17054099","5","156323558", etc for the line. </p>
  
  <p>I only want to write up until the number before the 3rd comma. I need some help modifying write line to only write up until the third comma. This file is very large and I'm hoping that any new code won't slow the program down but rather speed it up. Thanks Bob</p>