我有一个字典列表:
[{'title':'New York Times', 'title_url':'New_York_Times','id':4},
{'title':'USA Today','title_url':'USA_Today','id':6},
{'title':'Apple News','title_url':'Apple_News','id':2}]
我想按标题排序,这样带有A的元素就会在Z之前:
[{'title':'Apple News','title_url':'Apple_News','id':2},
{'title':'New York Times', 'title_url':'New_York_Times','id':4},
{'title':'USA Today','title_url':'USA_Today','id':6}]
如何最好地实现这个?此外,是否有一种方法可以确保每个字典键的顺序保持不变,例如总是按照标题、标题URL,然后是ID的顺序?