"yawgmoth7" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> for ips in range(startip,endip):
>     <do blah>
>

Here's one way:

def iterIPs(startip,endip):
    import socket, struct
    sip = struct.unpack('>L',socket.inet_aton(startip))[0]
    eip = struct.unpack('>L',socket.inet_aton(endip))[0]
    while sip <= eip:
        yield socket.inet_ntoa(struct.pack('>L',sip))
        sip += 1

for ii in iterIPs ('1.2.3.0','1.2.3.127'): ii


Emile 



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

Reply via email to