?
=?iso-8859-1?B?R3V5b24gTW9y6WU=?=
hi all,
i have a big list of tuples like this:
[ (host, port, protocol, startime, endtime), .. ] etc
now i have another big(ger) list of tuples like this:
[(src_host, src_port, dest_src, dest_port, protocol, time), ... ] etc
now i need to find all the items in the second list where either
src_host/src_port or dest_host/dest_port matches, protocol matches and
time is between starttime and end time.
After trynig some stuff out i actually found dictionary lookup pretty
fast. Putting the first list in a dict like this:
dict[(host,port,protocol)] = (starttime, endtime)
then:
if (((src_host,src_port, protocol) in dict or (dest_host, dest_port,
protocol) in dict) and starttime < time < endtime):
print "we have a winner"
I have also been looking at the bisect module, but couldnt figure out
if it was what I was looking for...
any ideas?
regards,
Guyon Moree
http;//gumuz.looze.net/
i have a big list of tuples like this:
[ (host, port, protocol, startime, endtime), .. ] etc
now i have another big(ger) list of tuples like this:
[(src_host, src_port, dest_src, dest_port, protocol, time), ... ] etc
now i need to find all the items in the second list where either
src_host/src_port or dest_host/dest_port matches, protocol matches and
time is between starttime and end time.
After trynig some stuff out i actually found dictionary lookup pretty
fast. Putting the first list in a dict like this:
dict[(host,port,protocol)] = (starttime, endtime)
then:
if (((src_host,src_port, protocol) in dict or (dest_host, dest_port,
protocol) in dict) and starttime < time < endtime):
print "we have a winner"
I have also been looking at the bisect module, but couldnt figure out
if it was what I was looking for...
any ideas?
regards,
Guyon Moree
http;//gumuz.looze.net/