sorting a list with an item in the list
This question already has an answer here:
Give it a try:
>>> from operator import itemgetter
>>> sorted(d8, key=itemgetter('startdate_iso'))
sorted
produces a new list. If you want to sort in place, use sort()
:
>>> d8.sort(key=itemgetter('startdate_iso'))
链接地址: http://www.djcxy.com/p/70782.html
上一篇: 如何用字典排序列表?
下一篇: 使用列表中的项目对列表进行排序