title: How to get length of each string in a csv row then use that in formating number of elements to grab
body: <p>Here is what I have so far for some reason this will only grab one row. What I would like it to do is check all of the rows to get the length of each string then if the string length is &lt;= 8 only grab first 8 elements or if the string length is >= 8 grab the first 10 elements. Any help would be greatly appreciated. </p>
  
  <pre><code> #example data from Book1.csv
  
   #hello 
   #thisislongerthaneight
   #whatareyoudoing
   #small
  
  
  
  import csv 
  import os 
  import unicodecsv 
  
  reader = csv.reader(open('Book1.csv', 'rb')) 
  writer = csv.writer(open('Book2.csv', 'wb')) 
  for row in reader: 
      length = len(row) 
      if length &lt;= 8: 
          newRow = [elem[: 8] 
              for elem in row 
          ] 
      elif length &gt;= 8: 
          newRow = [elem[: 10] 
              for elem in row 
          ] 
      writer.writerow(newRow) 
  </code></pre>
  
  <p>So what I get out currenty is just this </p>
  
  <pre><code> hello 
  </code></pre>
  
  <p>What I would like to get out is this </p>
  
  <pre><code>hello
  thisislong
  whatareyou
  small
  </code></pre>