擅长:python、mysql、java
<p>这是有效的:</p>
<pre><code>>>> ListA = [1,2,3]
>>> ListB = [10,20,30]
>>> list(map(sum, zip(ListA, ListB)))
[11, 22, 33]
>>>
</code></pre>
<p>上面使用的所有内置程序都解释了<a href="http://docs.python.org/3.2/library/functions.html" rel="nofollow noreferrer">here</a>。在</p>
<hr/>
<p>另一种解决方案是使用<a href="http://docs.python.org/3.2/tutorial/datastructures.html#list-comprehensions" rel="nofollow noreferrer">list comprehension</a>。在</p>
<p>根据你的口味,你可以这样做:</p>
^{pr2}$
<p>或者这个:</p>
<pre><code>>>> [x+y for x,y in zip(ListA, ListB)]
[11, 22, 33]
>>>
</code></pre>