擅长:python、mysql、java
<P>您可以考虑首先定义在一个数字列表上运行的^ {CD1>}函数,然后将其应用到^ {CD2>}的每一个列表中(在我的例子中,它是^ {CD3>}):</p>
<pre><code>def sum(xs):
# traverse each element of xs
# and return the sum
def sum_sublist(xss):
# traverse each element of xss
# which are lists, apply the `sum` function
# defined above on each, and return the list of the sums
</code></pre>