human
Ordering a list of dictionaries in python
assistant
Here is some code to sort a list of dictionaries `mylist` by keys "weight" and "factor"

mylist.sort(key=operator.itemgetter('weight', 'factor'))

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.