title: ValueError: invalid literal for float() in Python
body: <p>To all: </p>
  
  <p>I have curious if someone can help me understand the error: ValueError: invalid literal for float(). I am getting this when I am passing a text file to a list then trying to convert this list to float values.</p>
  
  <pre><code>a = open("input.txt","r")
  lines = a.readlines()
  b = map(float, lines)
  </code></pre>
  
  <p>What is odd, at least to me is that when I process:</p>
  
  <pre><code>print repr(lines[0])
  </code></pre>
  
  <p>I get: </p>
  
  <p>'0.000\t0.000...\t0.000\t0.000\n'</p>
  
  <p>and </p>
  
  <pre><code>print type(lines[0])
  </code></pre>
  
  <p>I get: </p>
  
  <pre><code>&lt;type 'str'&gt;
  </code></pre>
  
  <p>I don't understand therefore why the map(float, lines) does not work correctly. Am I using this function incorrectly? Looking at the documentation the map function is given as: map(function, iterable, ...). Is a list not iterable? </p>
  
  <p>Also if someone could explain this error/point me in the direction of an explanation for this error I would greatly appreciate it. </p>
  
  <p>Thanks in advance for help with this question. </p>