Yves Glodt:
>I would need e.g. this:
>(a list of ports and protocols, to be treated later in a loop)
[...]
>What would be the appropriate pythonic way of doing this?

In the case of tcp and udp ports, it's the combination of protocol and
port number that's unique, not the port number by itself.

So you could create a dictionary with a tuple (protocol, port) as key, and
whatever data you need to associate with it as value.

mydict = { ('udp',5631): 'value1', 
           ('tcp',3389): 'value2' }

-- 
René Pijlman
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to