[Tutor] Finding all IP addresses associated with a host

Emile van Sebille emile at fenx.com
Fri Apr 10 01:25:24 CEST 2009


Scott Newton wrote:
> I'm very new to python, and my google-fu has failed to locate an answer 
> to the following:
> 
> How can I find all of the (ipv4) addresses that are currently up on a host?


In google I searched for "python what's my ip" and about the fourth 
entry down found a link that led me to 
http://pypi.python.org/pypi/netifaces/0.3

How far does that get you?

HTH,

Emile



> 
> I realize I can call ifconfig and then munge the output with awk, but 
> that seems messy, and before I tried that I though I would ask around.
> 
> To give a bit more information, I'm writing a script that will use the 
> ip address assigned to the wifi interface to determine location (this is 
> on a Mac) and then mount network drives appropriate to the location. If 
> anyone has a better idea how to do this, I'd be happy to hear them.
> 
> Thanks in advance!
> 
> Scott Newton
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor



More information about the Tutor mailing list