I'm currently using this code to sort the question or tags lists...

        tag_labels = []
        for k in range(n_maxtags):
                tag_labels += s.tag_info(cookie,k*100,100)
        tag_labels += s.tag_info(cookie,n_maxtags*100,n_maxtags_rem)
        z = []
        for k in range(max_tags):
                z += [(k,tag_labels[k]['a_tag_id'])]

        z.sort(lambda x,y:cmp(x[1],y[1]))

        o = []
        for k in range(max_tags):
                o += [ tag_labels[z[k][0]] ]

        tag_labels = o

...but a voice from nowhere tells me that there must be a simpler way to do that. :P

        Thanks. Lyu

Demexp-dev mailing list

Répondre à