python sort with two keys code example Example: sort by multiple keys in object python s = sorted(s, key = lambda x: (x[1], x[2]))