title: Trying to convert to numbers with try except
body: <p>I'm trying to convert the items in a list of multiple types to floats, so that</p>
  
  <pre><code>L = ["29.3", "tea", "1", None, 3.14]
  </code></pre>
  
  <p>would become</p>
  
  <pre><code>D = [29.3, "tea", 1, None, 3.14]
  </code></pre>
  
  <p>My attempt is as follows:</p>
  
  <pre><code>L = ["29.3", "tea", "1", None, 3.14]
  D = []
  for item in L:
      try:
          float(item)
          D.append(item)
      except ValueError:
          D.append(item)
  
  print(D)
  </code></pre>
  
  <p>This throws up a</p>
  
  <blockquote>
  <pre><code>line 5, in &lt;module&gt;
      float(item)
  TypeError: float() argument must be a string or a number, not 'NoneType'` error. 
  </code></pre>
  </blockquote>
  
  <p>If I change the <code>None</code> item to a string as in <code>"None"</code>, it generates a list <code>D</code> identical to <code>L</code>. So...</p>
  
  <ol>
  <li>How do I skip over the <code>None</code> item? Do I have to use an <code>if item == None: pass</code> statement, or is there a better way?</li>
  <li>Why is the type conversion not working even if I change <code>None</code> to <code>"None"</code>?</li>
  </ol>