How to get IP address

John Abel john.abel at pa.press.net
Sun Mar 2 18:06:14 EST 2003


 I may be missing something of what you're after here.
socket.gethostbyaddr( socket.gethostname() ) will return all the details
that you need to know.  For example, the output of that command on my
machine is :

('hallows', [], ['101.101.101.102', '10.253.1.118'])

I have two adapters, one of which is DHCP.  The hostname is that, given to
your machine during the install.

Regards

John






More information about the Python-list mailing list