[Tutor] IP sorting

Grimmtooth grimmtoothtoo@yahoo.com
Thu, 27 Dec 2001 10:31:54 -0500

> How to sort domain names AND IP addresses? NB. Domain names better to sort
> starting from level 1.
> bbb.aa
> aaa.bb
> ccc.cc

I'm sure someone more familiar with Python than I will have a slicker
solution, but I believe that if you split() the components of such things
into an array of tuples [(bbb,aa), (aaa,bb), (ccc.cc)] then you can compare
each tuple directly, e.g. (bbb,aa) > (aaa,bb). From there it should be a
fairly easy excercise to do the actual sort.

Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com