I\'m trying to display some results in a human-readable way. For the purposes of this question, some of them are numbers, some are letters, some are a combination of the two.
This will do it. For purposes of comparison, it converts strings that can be converted to an integer to that integer, and leaves other strings alone:
def key(s): try: return int(s) except ValueError: return s sorted_input = sorted(input, key=key)