I have a list of dictionaries:
[{'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}]
I'd like to sort it by the title, so elements with A go before 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}]
What's the best way to do this?
Also, is there a way to ensure the order of each dictionary key stays constant, e.g., always title, title_url, then id?
Thank you.