Can anyone thing of a more eligant way of doing this? I am trying to extract the keys of my dict and sort them according to size, but this currently seems kinda crude temp = [(len(x), x) for x in motifs.keys()] temp.sort() temp.reverse() motiflist = [x[1] for x in temp] blobby