title: in Python how to convert number to float in a mixed list
body: <p>I have a list of strings in the form like</p>
  
  <pre><code>a = ['str','5','','4.1']
  </code></pre>
  
  <p>I want to convert all numbers in the list to float, but leave the rest unchanged, like this</p>
  
  <pre><code>a = ['str',5,'',4.1]
  </code></pre>
  
  <p>I tried </p>
  
  <pre><code>map(float,a)
  </code></pre>
  
  <p>but apparently it gave me an error because some string cannot be converted to float. I also tried</p>
  
  <pre><code>a[:] = [float(x) for x in a if x.isdigit()]
  </code></pre>
  
  <p>but it only gives me</p>
  
  <pre><code>[5]
  </code></pre>
  
  <p>so the float number and all other strings are lost. What should I do to keep the string and number at the same time?</p>