License: (CC 3.0) BY-NC-SA sort a dict by value: sorted(d.iteritems(), key=lambda x: x[1]) sort a dict list by a key: l.sort(key=lambda x: x[key])