sorting strings by size

Mark Robinson m.1.robinson at herts.ac.uk
Thu Aug 9 06:32:41 EDT 2001


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




More information about the Python-list mailing list