def alphanum_key(s):
    """ Turn a string into a list of string and number chunks.
        "z23a" -> ["z", 23, "a"]
    """
return [tryint(c) for c in re.split('([0-9]+)', s)]

def sort_nicely(l):
    pass
How do you sort files numerically?