title: How to extract and copy lines from csv file to another csv file in python?
body: <p>Let's suppose that I have a big data in a csv file:This is a set of lines from my file: </p>
  
  <pre><code>frame.number    frame.len   frame.cap_len   frame.Type  
    1               100           100           ICMP_tt   
    2                64            64           UDP   
    3               100           100           ICMP_tt   
    4                87            64           ICMP_nn
  </code></pre>
  
  <p>I want to extract 30 % from this file and put it in another csv file.</p>
  
  <p>I try by using this code but it gives me selection per row not per line:</p>
  
  <pre><code>import csv
  
  data = [] #Buffer list 
  with open("E:\\Test.csv", "rb") as the_file:
      reader = csv.reader(the_file, delimiter=",")
      for line in reader:
  
          try:
              new_line = [line[0], line[1]]
              #Basically ´write the rows to a list
              data.append(new_line)
          except IndexError as e:
              print e
              pass
  
      with open("E:\\NewTest.csv", "w+") as to_file:
          writer = csv.writer(to_file, delimiter=",")
          for new_line in data:
              writer.writerow(new_line)
  </code></pre>
  
  <p>I try </p>