title: Remove comma and change string to float
body: <p>I want to find &quot;money&quot; in a file and change the <code>string</code> to <code>float</code> , for example, I use regular expression to find &quot;$33,326&quot; and would like to change to [33326.0, &quot;$&quot;] (i.e., remove comma, $ sign and change to <code>float</code>). I wrote the following function but it gives me an error</p>
  <pre><code>import locale,re
  def currencyToFloat(x):
      empty = []
      reNum = re.compile(r&quot;&quot;&quot;(?P&lt;prefix&gt;\$)?(?P&lt;number&gt;[.,0-9]+)(?P&lt;suffix&gt;\s+[a-zA-Z]+)?&quot;&quot;&quot;)
      new = reNum.findall(x)
      for i in new:
          i[1].replace(&quot;,&quot;, &quot;&quot;)
          float(i[1])
          empty.append(i[1])
          empty.append(i[0])
      return empty
  
  print currencyToFloat(&quot;$33,326&quot;)
  </code></pre>
  <p>Can you help me debug my code?</p>