"Johny" <[EMAIL PROTECTED]> escribió en el mensaje 
news:[EMAIL PROTECTED]

> How can I find server's IP address?
>>From console I can use ping, for example:
>
> C:\RobotP\cgi-bin>ping www.google.com
> Pinging www.google.com [209.85.129.147] with 32 bytes of data:
> [...]
> But how can I find it directly from Python script?

py> import socket
py> help(socket.gethostbyname)
Help on built-in function gethostbyname in module _socket:

gethostbyname(...)
    gethostbyname(host) -> address

    Return the IP address (a string of the form '255.255.255.255') for a 
host.

py> socket.gethostbyname("www.google.com")
'209.85.165.147'

-- 
Gabriel Genellina 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to