[Tutor] Get IP address?

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Sun, 11 Feb 2001 21:58:22 -0800 (PST)


On Sun, 11 Feb 2001, William Ryu wrote:

> Is there a function to get the IP address of your machine?

According to:

    http://python.org/doc/current/lib/module-socket.html

you can do this with the socket module:

    from socket import gethostbyname, gethostname
    print gethostbyname(gethostname())