Re: My First Python Script

2005-09-16 Thread Ed Hotchkiss
Someone else actually got me some help, the end result he hooked me up with was:   # function to evaluate all possible IPs def findIPs(): ipFile = open("IPList.txt", 'w') for octet1 in range(256): for octet2 in range(256): for octet3 in range(256): for octet4 in range(256): ipAddress = '%03.d.%03.

Re: My First Python Script

2005-09-16 Thread John Hazen
* Ed Hotchkiss <[EMAIL PROTECTED]> [2005-09-15 20:36]: > But then I still get the error with the len(x) statement .. hmm Ahh. In the future, it will help us help you, if you make it clear that there was an error, and *paste the exact error* into your mail. For example, I'm guessing the error you

Re: My First Python Script

2005-09-16 Thread Ed Hotchkiss
  Sweet, time to play with python for a whole day today :P  On 9/16/05, Gary Wilson Jr <[EMAIL PROTECTED]> wrote: Ed Hotchkiss wrote:> def ZeroThrough255():>   x = 0>   while x <= 255: >   if len(x) == 1:>   mySet = '00' + str(x)>   elif len(x) ==

Re: My First Python Script

2005-09-16 Thread Gary Wilson Jr
Ed Hotchkiss wrote: > def ZeroThrough255(): > x = 0 > while x <= 255: > if len(x) == 1: > mySet = '00' + str(x) > elif len(x) == 2: > mySet = '0' + str(x) > else: > mySet = x >

Re: My First Python Script

2005-09-15 Thread Robert Kern
Ed Hotchkiss wrote: > But then I still get the error with the len(x) statement .. hmm That's because integers don't have a length. But if you follow James' advice, you don't need to calculate lengths of anything. -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high

Re: My First Python Script

2005-09-15 Thread Ed Hotchkiss
But then I still get the error with the len(x) statement .. hmm     On 9/15/05, James Stroud <[EMAIL PROTECTED]> wrote: Try the % operator with strings.For instance: "%03.d" % 5py> "%03.d" % 5 '005'This operator, from what I have experienced, has the same properties as theunix printf. In python, I

Re: My First Python Script

2005-09-15 Thread James Stroud
Try the % operator with strings. For instance: "%03.d" % 5 py> "%03.d" % 5 '005' This operator, from what I have experienced, has the same properties as the unix printf. In python, I think its called "string formatting". James On Thursday 15 September 2005 20:33, Ed Hotchkiss wrote: > So I ha