[{\'date\': \'2010-04-01\', \'people\': 1047, \'hits\': 4522}, {\'date\': \'2010-04-03\', \'people\': 617, \'hits\': 2582}, {\'date\': \'2010-04-02\', \'people\': 73
Satoru.Logic's solution is clean and simple. But, per Alex's post, you don't need to manipulate the date string to get the sort order right...so lose the .split('-')
.split('-')
This code will suffice:
records.sort(key=lambda x:x['date'])