Interesting (?) problem

mk mrkafk at gmail.com
Mon Jan 11 18:57:24 CET 2010


mk wrote:
> Hello everyone,
> 
> I have two lists of IP addresses:
> 
> hostips = [ 'a', 'b', 'c', 'd', 'e' ]
> 
> thread_results = [ 'd', 'b', 'c' ]
> 
> I need to sort thread_results in the same order as hostips.

P.S. One clarification: those lists are actually more complicated 
(thread_result is a list of tuples (ip, thread)), which is why I need 
thread_results sorted in order of hostips (instead of just constructing 
[ h for h in hostips if h in thread_results ] and be done with it).







More information about the Python-list mailing list