socket.gethostbyname() AttributeError

Skip Montanaro skip at pobox.com
Tue Mar 19 09:22:44 EST 2002


    ralph> I assumed that for scoket.gethostbyname(host), I was to pass a
    ralph> host of the type "theodore.chipmunks.com" and that I would get
    ralph> back an IP address as a doted quad.  Obviously I am wrong about
    ralph> the form of the arguement I am to pass to the function, because I
    ralph> am getting an AttributeError message.

Probably a typo on your part.  Works for me:

    >>> import socket
    >>> socket.gethostbyname("www.yahoo.com")
    '64.58.76.222'

-- 
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)




More information about the Python-list mailing list