擅长:python、mysql、java
<p><a href="https://docs.python.org/2/tutorial/datastructures.html#list-comprehensions" rel="nofollow">List comprehensions</a>会为你做很多事情。在</p>
<p>比如:</p>
<pre><code>gyro_x_lsb_sum = sum(float(item) for item in gyro_x_lsb)
</code></pre>
<p>这里我使用的是<a href="https://docs.python.org/2/reference/expressions.html#generator-expressions" rel="nofollow">a generator expression</a>,它与列表理解的语法相同,但是在本例中性能更好。在</p>
<p>希望能有点帮助。在</p>
<p>考虑使用Python<code>csv</code>模块来读取CSV文件。</em></p>