Re: Fwd: [Tutor] Create list of IPs

2005-02-20 Thread Kent Johnson
[EMAIL PROTECTED] wrote: Liam Clarke wrote: [ snip ] - increment an IP. This is the hardest part. Why? An ip (V4) is just an 32bit integer :-) The problem arises from the representation. Use something like "http://pynms.sourceforge.net/ipv4.html"; to switch between the various representations.

Re: Fwd: [Tutor] Create list of IPs

2005-02-20 Thread R. Alan Monroe
>> Liam Clarke wrote: > [ snip ] >> - increment an IP. This is the hardest part. > Why? An ip (V4) is just an 32bit integer :-) Indeed. Some early versions of MacTCP for MacOS made you input the address as a single large decimal number :^) Alan ___

Re: Fwd: [Tutor] Create list of IPs

2005-02-20 Thread lumbricus
> Liam Clarke wrote: [ snip ] > - increment an IP. This is the hardest part. Why? An ip (V4) is just an 32bit integer :-) The problem arises from the representation. Use something like "http://pynms.sourceforge.net/ipv4.html"; to switch between the various representations. > Kent HTH and Gree

Re: Fwd: [Tutor] Create list of IPs

2005-02-20 Thread Kent Johnson
Liam Clarke wrote: Hi, you could save yourself some hassle and do minipstr = '1.0.0.1' maxipstr = '1.0.15.16' minip = map(int, minipstr.split('.')) maxip = map(int, maxipstr.split('.')) iplist = [] for a in range(minip[2], maxip[2]+1): ... if a < maxip[2]: ... for b in range(minip[

Fwd: [Tutor] Create list of IPs

2005-02-20 Thread Liam Clarke
Erp. -- Forwarded message -- From: Liam Clarke <[EMAIL PROTECTED]> Date: Sun, 20 Feb 2005 23:42:43 +1300 Subject: Re: [Tutor] Create list of IPs To: Ralfas Jegorovas <[EMAIL PROTECTED]> Hi, you could save yourself some hassle and do >>> minipstr = &

Re: [Tutor] Create list of IPs

2005-02-20 Thread Liam Clarke
> Date: Sun, 20 Feb 2005 23:42:43 +1300 > Subject: Re: [Tutor] Create list of IPs > To: Ralfas Jegorovas <[EMAIL PROTECTED]> > > Hi, you could save yourself some hassle and do > > >>> minipstr = '1.0.0.1' > >>> maxipstr = '1.0.15.1

[Tutor] Create list of IPs

2005-02-20 Thread Ralfas Jegorovas
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 iplist = [] minip = ['1','0','0','1'] # startin