title: Deleting specific lines in csv files
body: <p>The csv file looks like below: (with a thousand more lines)</p>
  
  <pre class="lang-none prettyprint-override"><code>step0:  
  141  
  step1:  
  140   
  step2:  
  4  
  step3:  
  139  
  step4:  
  137  
  step5:  
  136  
  15  
  step6:  
  134  
  13  
  139  
  step7:  
  133  
  19  
  </code></pre>
  
  <p>I am trying to read each line and remove lines (the ones that includes numbers only) that are, say, greater than 27.</p>
  
  <p>Originally, my csv file a string file, so all of the lines are considered strings.</p>
  
  <p>What I have done is the following:</p>
  
  <ol>
  <li>first loop through the lines that does not include "step" in them  </li>
  <li>change them into float  </li>
  <li>remove all that are greater than 27  </li>
  </ol>
  
  <p>Now I want to save (overwrite) my file after deleting these numbers but I am stuck.<br>
  Could someone assist?</p>
  
  <pre><code>import csv
  f = open('list.csv', 'r')
  reader = csv.reader(f, delimiter="\n")
  for row in reader:
      for e in row:
          if 'step' not in e:
              d=float(e)                  
              if d&gt;27:
                  del(d)
  </code></pre>