python sort list of tuples lexicographically code example
Example: python sort list of tuples lexicographically
sorted_by_length = sorted(list_,
key=lambda x: (x[0], len(x[1]), float(x[1])))
sorted_by_length = sorted(list_,
key=lambda x: (x[0], len(x[1]), float(x[1])))