> suppose I type:
> ip = 123.45.67.89

This is probably far from what you want,
but I would do something like this:

********************************************
class ip(list):

        def __init__(self, ip):

                bytes = ip.split('.')
                for x in range(4):
                        self.append(bytes[x])

        def __repr__(self):

                return '.'.join(self)


localhost = ip('192.168.1.1')

print localhost
print localhost[2]
*******************************************
192.168.1.1
1

That way at least you can get at the value
in both of the meaningful ways, and you can
probably think of more methods, like applying
netmasks, etc...


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to