擅长:python、mysql、java
<p>您可以使用numpy快速执行此操作:</p>
<pre><code>data="""
0 4028.44 4544434.50 -6.76 -117.00 0.0002 0.12
0 4028.50 3455014.50 -5.86 0 0.0003 0.39
0 7028.56 4523434.50 -4.95 -137.00 0.0005 0.25
0 8828.62 4543414.50 -3.05 0 0.0021 0.61
0 4028.44 4544434.50 -6.76 -107.00 0.0002 0.12
0 4028.50 3455014.50 -5.86 -11.00 0.0003 0.39
0 7028.56 4523434.50 -4.95 -127.00 0.0005 0.25
0 8828.62 4543414.50 -3.05 0 0.0021 0.61
"""
from StringIO import StringIO
import numpy as np
d = np.loadtxt(StringIO(data)) # load the text in to a 2d numpy array
print d[d[:,4]!=0] # choose column 5 != 0
print d[(d[:,4]>=50)|(d[:,4]<=-30)] # choose column 5 >=50 or <=-30
</code></pre>