> 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
> 
**snip**

> I'd appreciate any help.
> 
> Thanks,
> Ralf
> 

It looks like you need not concern yourself with
the ['1','0',...] part of your array(s).
Only to increment from '0','1' to '15','16'
Keeping with arrays, you could get last position
of the array and increment number until 16.
If last position > 15, stop incrementation and move to
next to last position in the array until it reaches 15
(also breaks to to adding 15 to each octet in the last
two array positions, one by one)


> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to