Python - 排序词典列表?

时间:2017-12-06 21:12:52

标签: python

我有以下词典列表:

my_list = [ 
    {
       "field1": value,
       "field2": value,
       "time": 2017-12-01 14:34:12,
       "field3": value
    },
    {
       "field1": value,
       "field2": value,
       "time": 2017-12-01 14:31:20,
       "field3": value
    },
    {
       "field1": value,
       "field2": value,
       "time": 2017-12-01 14:40:02,
       "field3": value
    }
]

如何按字典的time值对此列表进行排序? (因此具有最高time值的字典将位于列表的第一个索引中,依此类推..)

谢谢!

0 个答案:

没有答案