socket.gethostbyaddr problem

jepler at unpythonic.net jepler at unpythonic.net
Sat Sep 17 22:50:51 EDT 2005


Perhaps you mean to use the function socket.gethostbyname instead.

>>> import socket
>>> socket.gethostbyaddr("www.google.ca")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
socket.herror: (1, 'Unknown host')
>>> socket.gethostbyname("www.google.ca")
'64.233.167.147'

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050917/f42e32bb/attachment.sig>


More information about the Python-list mailing list