擅长:python、mysql、java
<p>使用内置函数的另一种方法是使用<a href="http://docs.python.org/2/library/functions.html#reduce" rel="nofollow noreferrer">reduce</a>函数:</p>
<pre><code>>>> numeric = lambda x: int(x) if x.isdigit() else 0
>>> reduce(lambda x, y: x + numeric(y), 'hihello153john', 0)
9
</code></pre>