我写了一个查询,它返回一个结果集,如下所示,
result = [
{"total_requests" : "4", "requesttimestamp" : null},
{"total_requests" : "2", "requesttimestamp" : null},
{"total_requests" : "4", "requesttimestamp" : null},
{"total_requests" : "7", "requesttimestamp" : null},
{"total_requests" : "1", "requesttimestamp" : 1.37412742E9},
{"total_requests" : "1", "requesttimestamp" : 1.37412781E9},
{"total_requests" : "1", "requesttimestamp" : 1.374127424E9}
]
当尝试迭代这个
时result[i]["total_requests"] ,result[i]["requesttimestamp"]
获取未定义的结果对。
那么如何单独检索值对?
答案 0 :(得分:1)
可以通过result [i] .total_requests,result [i] .requesttimestamp
访问