I am trying to sort a list of tuples on the lexicographic order of the sub-string that the tuples are indicating.
In the following case, I wish to sort a which actaully represents ["sd", "dce", "ces"]. I'm not sure how to use the comparator to achieve this.
def cmp(key, text): return text[key[0]:key[1]+1]a = [(1,2), (2, 4), (3, 5)]text = "asdcesa"sorted(a, key=cmp(text))The above code would give this error "cmp() missing 1 required positional argument: 'text'"