我有不同元素的列表(字符串和浮点数),例如:
X = [['carrier', 'arrivaldelay', 'MAX', 0.43085409548228853],
['carrier', 'weatherdelay', 'SUM', 0.45040808607625615],
['carrier', 'arrivaldelay', 'SUM', 0.4166832477676661],
['destination', 'departurdelay', 'MAX', 0.4009409407356311],
['destination', 'arrivaldelay', 'AVG', 0.4216147060142493],
['origin', 'arrivaldelay', 'AVG', 0.4353396150129142],
['origin', 'arrivaldelay', 'MIN', 0.4157363968474399],
['origin', 'arrivaldelay', 'STD', 0.4478847651966835]]
根据最后一个值
获取具有最小值的列表的简单有效方法是什么?预期输出:['destination', 'departurdelay', 'MAX', 0.4009409407356311]
答案 0 :(得分:5)
我能想到的最简单:
def t3master():
""" thread which continuously updates the master ip address """
global masterip
s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 8477))
while True:
msg = s.recvfrom(1024)
masterip = msg[1][0]