[Tutor] IP Address from Python module?

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Fri Aug 5 23:15:02 CEST 2005



On Fri, 5 Aug 2005, Joseph Quigley wrote:

> Is it possible to get my internet and/or network IP address from Python?
> Is there any other way to get it?

Hi Joe,

I think you're looking for socket.gethostbyname().

    http://www.python.org/doc/lib/module-socket.html#l2h-2594

Here's an example using the socket.gethostbyname() function:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/335890



More information about the Tutor mailing list