actually, there is no need for that...
If you do a
print(my_latency_results)
Then you get all the results
If you use
my_latency = my_latency_results[-1]
print(my_latency) then you get the latest result which might look like this
{
"startTime": "2018-10-09T22:20:27Z",
"endTime": "2018-10-09T22:21:27Z",
"lossPercent": 0,
"latencyMs": 44
}
]
and the latency = my_latency['latencyMs']
and loss will be : loss = my_latency['lossPercent']