Sorting a list depending of the indexes of another sorted list
babui
jmgimeno at gmail.com
Mon Jan 21 02:45:23 EST 2008
On 21 ene, 08:41, Santiago Romero <srom... at gmail.com> wrote:
> Hi ...
>
> I have the following DNS MX records info:
>
> domain.com
> preference 10 host mx1.domain.com
> preference 30 host anotherhost.domain.com
> preference 20 host mx2.domain.com
> And finally ... do you think there is a better python structure to
> store this data and sort it in a more easy way?
Why don't you use a list of tuples?
L = [ (10, "mx1.domain.com"), (30, "anotherhost.domain.com", (20,
"mx2.domain.com") ]
and L.sort() sorts the list !!!
Juan M. Gimeno
> Thanks.
More information about the Python-list
mailing list