title: Invalid literal for float(): 0.000001, how to fix error?
body: <p>I have a .csv file containing 3 columns of data. I need to create a new output file that includes a specific set of data from the first and third column from the original file. The third column contains decimal values, and I believe in such a case I have use the float() feature of python. I have tried the following code:</p>
  
  <pre><code>in_file = open("filename.csv", "r")
  
  out_file = open("output.csv", "w")
  
  while True:
  
      line = in_file.readline()
      if (line == ''): 
          break
      line = line.strip() 
      items = line.split(',') 
      gi_name = items[0] 
      if (gi_name.startswith("_"))
          continue
      p_value = float(items[2]) 
      if (p_value &gt; 0.05):
          continue
      out_file.write(','.join([gene_name, str(p_value)]))
  in_file.close()
  out_file.close()
  </code></pre>
  
  <p>when I run the above, I recieve the following error:</p>
  
  <p>Error: invalid literal for float(): 0.000001</p>
  
  <p>the value 0.0000001 is the first value in my data set for the third column, and I guess the code cannot read beyond that set but I'm not sure why. I am new to python, and don't really understand why I am getting this error or how to fix it. I have tried other modifications for how to input the float(), but without success.  Does anyone know how I might be able to fix this?</p>