beginner question

Cere Davis ceremona2000 at yahoo.com
Fri Dec 27 02:40:29 EST 2002


Thanks everyone for your help.  I know about exceptions and all but I
must have spaced this one out thinking that the herror I was getting
was due to something more programatical in nature rathar than just
legitamate output.  It would be kind of cool if the docstring stuff in
the socket module listed the meaning of the various error types.

ceremona2000 at yahoo.com (Cere Davis) wrote in message news:<e32daabb.0212261951.3f90df25 at posting.google.com>...
> What's the deal with this?:
> 
> >>> for i in range(1,255):
> ...     st="122.97.71.%d" % (i,)
> ...     print gethostbyaddr(st)
> ...
> Traceback (most recent call last):
>   File "<stdin>", line 3, in ?
> socket.herror: (1, 'Unknown host')
> 
> but when I type in:
> 
> >>>  print gethostbyaddr("122.97.71.5")
> ('some.host.edu', [], ['122.97.71.5'])
> 
> 
> Does anyone know how I can get this simple for loop to work?
> 
> Thanks,
> Cere



More information about the Python-list mailing list