示例
json_array = [{"time":20150312,"value":"c"}, {"time":20150301,"value":"a"}, {"time":20150305,"value":"b"}]
json_array.sort(key = lambda x:x["time"])
运行结果:
print(json_array)
[{'value': 'a', 'time': 20150301},
{'value': 'b', 'time': 20150305},
{'value': 'c', 'time': 20150312}]
“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill
标 题:Python 针对Json中某个关键字段进行排序