1
我一直在使用Python,我很新的所有這種語言。我一直試圖讓一個列表變成數組,然後給每一行賦予最高的值。分辨率問題與我的ipython地圖(matplotlib)
現在,這個信息來自一個txt,到目前爲止,我有如下:
import re
from numpy import *
filesis= open("/home/ana/Escritorio/Python/CATALOGO_NIC_MW (otra copia).txt")
filelines= filesis.readlines()
magn1, magn2, magn3= [],[], [], []
for reader in filelines:
mag1=(((re.sub(r'[^0-9|.]', r'.00', (reader[56:59])))))
magn1=(mag1[0:3])
#****************************************************
mag2=(((re.sub(r'[^0-9|.]', r'.00 ', (reader[64:67])))))
magn2=(mag2[0:3])
#****************************************************
mag3=(((re.sub(r'[^0-9|.]', r'.00 ', (reader[72:75])))))
magn3=(mag3[0:3])
#****************************************************
for index in range(len(magnitud1)):
magnitudes.append([magnitud1[index],magnitud2[index],magnitud3[index]])
print magnitudes
但我的輸出如下:
[['5', '6', '6']]
[['5', '6', '6'], ['.', '.', '.']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'],['5', '1', '1']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['6', '6', '6']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['6', '6', '6'], ['.', '.', '.']]
[['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['5', '6', '6'], ['.', '.', '.'], ['5', '1', '1'], ['6', '6', '6'], ['.', '.', '.'], ['5', '8', '8']]
對不起,長職位,但我想向你展示它的外觀。
1522 0 0 0 0 0.00 11.830 -86.980 5.0 NIC 0 5.5SCAL 6.1WCAL 6.1WXXX1
1524 0 0 0 0 0.00 11.950 -86.150 5.0 NIC 0 5.5SCAL 6.1WCAL 6.1WXXX1
1527 0 0 0 0 0.00 12.600 -86.860 5.0 NIC 0 5.5SCAL 6.1WCAL 6.1WXXX1
1528 5 0 0 0 0.00 12.400 -86.800 33.0 NIC 0 6.5SCAL 6.8WCAL 6.8WXXX1
5.5SCAL 6.1WCAL 6.1WXXX1
5.5SCAL 6.1WCAL 6.1WXXX1
5.5SCAL 6.1WCAL 6.1WXXX1
6.5SCAL 6.8WCAL 6.8WXXX1
信息出來了上面的文本文件,然後在下面你會看到最後三行是我的信息源。
magnitude=[[5.5],[6.1],[6.1]]
[5.5],[6.1],[6.1]
[5.5],[6.1],[6.1]
[6.5],[6.8],[6.8]]
magnitude=[[6.1]]
[6.1]
[6.1]
[6.8]]
進出口尋找什麼,有一個像magnitude
數組,然後獲取數組的每一行的最高值,如上圖所示。 任何幫助,高度讚賞!