【发布时间】:2015-11-07 01:04:30
【问题描述】:
我有一个列表,在列表中我有一个字典,我想按字典的值对列表进行排序。
这是如何工作的?
[{'id': 0, 'thread': 'First',
'post': [
{'id': 0, 'title': 'MyPost', 'time': '2015-11-07 01:06:08.939687'}]
},
{'id': 1, 'thread': 'Second',
'post': [
{'id': 0, 'title': 'MyPost', 'time': '2015-11-07 01:06:42.933263'}]},
{'id': 2, 'name': 'NoPosts', 'post': []}]
我想按第一次发帖的时间对我的话题列表进行排序,可以吗?
【问题讨论】:
标签: python list sorting dictionary