I’m having an issue with sorting a list that contains a dict. Currently I am sorting it by a key called ‘title’ with the following line:
list.sort(key=operator.itemgetter('title'))
The problem with this is that some of my data gets sorted looking like this:
title_text #49
title_text #5
title_text #50
How would I go about sorting it in a way that is more friendly for human consumption while still maintaining the title sort?
You are looking for human sorting.
Edit: If your
datais a list of dicts then: