I am wondering how I would go about making a list of IPs between two set IPs.
This is my initial code:


<my code>

def list2str(list):
   ip=''
   for part in list:
       if len(ip)!=0:
           ip=ip+'.'+part
       else:
           ip=ip+part
   return ip

iplist = []

minip = ['1','0','0','1'] # starting IP
maxip = ['1','0','15','16'] # ending IP

currentip = minip # set currentip to value of minip

while currentip != maxip: # carry out while currentip is not the same as the maxip
iplist.append(list2str(currentip))
if currentip[2]<maxip[2] and currentip[3]<256:
currentip[3] = currentip[3]+1


<end my code>

I'd appreciate any help.

Thanks,
Ralf


_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Reply via email to