擅长:python、mysql、java
<p>受Shahar Bental上述答案的启发,我得到了另一个不太依赖正则表达式的解决方案,并使用python中的split方法。但不确定是否更好</p>
<p>我在以前的脚本中添加了以下内容:</p>
<pre><code>words = x.split(' ')
for word in words:
if '%' in word:
return float((re.sub(r'[^\d,]', '', word)).replace(',','.'))
</code></pre>