[Tutor] Re: Create list of IPs

2005-02-20 Thread Greg T
> I am wondering how I would go about making a list of > IPs between two set > IPs. > This is my initial code: > > > > def list2str(list): > ip='' > for part in list: > if len(ip)!=0: > ip=ip+'.'+part > else: > ip=ip+part > return ip > > ip

[Tutor] Re: Create list of IPs

2005-02-20 Thread Ralfas Jegorovas
Thanks alot to everyone for your help! I'm not completely sure I understand how Roel's code works so I'll be doing a bit of research :-) (but it works :-D). Thanks again. All the best, Ralf ___ Tutor maillist - Tutor@python.org http://mail.python.org/

[Tutor] Re: Create list of IPs

2005-02-20 Thread Roel Schroeven
Ralfas Jegorovas wrote: > I am wondering how I would go about making a list of IPs between two set > IPs. # First, list2str can be written shorter .def list2str(lst): .return '.'.join(map(str, lst)) # The inverse of that is also needed .def str2list(s): .return map(int, s.split('.')) # N