我有5个可变数目的索引列表。第一个是Azimutes列表:
lista_az = ['72', '252'], ['90.9', '270.8'], ['78.4', '258.3'], ['280', '100.3'], ['327.1', '147.1'], ['259.1', '293.8', '79.1', '113.8'], ['126.9', '306.8'], ['205.9', '25.9', '41.5', '221.5'] (...)
Tx列表:
tx = ['8468.00000000 MHz', '8349.00000000 MHz'], ['8349.00000000 MHz', '8468.00000000 MHz'], ['8482.00000000 MHz', '8363.00000000 MHz'], ['8468.00000000 MHz', '8349.00000000 MHz'], ['15.20100000 GHz', '14.78100000 GHz'], ['14.76700000 GHz', '14.80900000 GHz', '15.18700000 GHz', '15.22900000 GHz'], ['1508.50000000 MHz', '1443.00000000 MHz'], ['1450.00000000 MHz', '1515.50000000 MHz', '8468.00000000 MHz', '8349.00000000 MHz'] (...)
Rx列表:
rx = ['8349.00000000 MHz', '8468.00000000 MHz'], ['8468.00000000 MHz', '8349.00000000 MHz'], ['8363.00000000 MHz', '8482.00000000 MHz'], ['8349.00000000 MHz', '8468.00000000 MHz'], ['14.78100000 GHz', '15.20100000 GHz'], ['15.18700000 GHz', '15.22900000 GHz', '14.76700000 GHz', '14.80900000 GHz'], ['1443.00000000 MHz', '1508.50000000 MHz'], ['1515.50000000 MHz', '1450.00000000 MHz', '8349.00000000 MHz', '8468.00000000 MHz'] (...)
极化列表:
pol = ['V', 'V'], ['H', 'H'], ['V', 'V'], ['V', 'V'], ['V', 'V'], ['V', 'V', 'V', 'V'], ['V', 'V'], ['V', 'V', 'V', 'V'] (...)
网络列表:
net = ['1', '1'], ['2', '2'], ['3', '3'], ['4', '4'], ['5', '5'], ['6', '6', '6', '6'], ['7', '7'], ['8', '8', '8', '8']
我正在尝试比较同一列表中的每个元素,以用于Azimute列表:
Azimute(list 1) = 252 - 72 = 180 OK
Azimute(list 2) = 90.9 - 270.8 =~ -180 OK
比较Tx的第一个列表和Rx的第一个列表,
first tx: 8468.00000000 with second Rx: 8468.00000000, and
second tx with first rx, and so on.
试图找到tx和rx的匹配项(等于值)。
在极化列表中,如果第一个元素等于第二个元素,如果第一个元素等于第三个元素(仅当列表具有此大小时),依此类推。
我尝试这样做:
for lista in range(1, len(lista_az)):
for x in range(0, len(lista_az[lista])-1):
try:
if net[lista][x] == net[lista][x+y]:
if tx[lista][x] == rx[lista][x+y]:
if tx[lista][x+y] == rx[lista][x]:
if round(abs(float(lista_az[lista][x]) -float(lista_az[lista][x+y]))) == 180:
if pol[lista][x] == pol[lista][x+y]:
print("Link of list: ", lista)
print("Latitude A: ", lat[lista][x]);
print("Latitude B: ", lat[lista][x+y])
print("Longitude A: ", lon[lista][x]); print("Longitude B: ", lon[lista][x + y])
print("Height A: ", hei[lista][x]); print("Height B: ", hei[lista][x+y])
except IndexError:
value = None
预期输出为(对于所有列表的第一个列表):
first tx = second rx, 8468.00000000 = 8468.00000000 OK next,
second tx = first rx, 8349.00000000 = 8349.00000000 OK next,
azimute: 72- 252 = 180 is an link OK next,
polarization of first element is equal of second: V = V OK
好的,这是一个链接,之后我将了解这两个元素的纬度,经度和高度。 但是,当循环包含两个以上元素的列表时,它不会打印任何内容。