Get IP address of WIFI interface

Jun Hu hujun.work at gmail.com
Sat May 14 12:02:59 EDT 2011


Thanks, is there any other way without using external command?

On Fri, May 13, 2011 at 10:41 PM, Ishwor Gurung <ishwor.gurung at gmail.com>wrote:

> Hi.
>
> On 14 May 2011 14:46, Far.Runner <far.runner at gmail.com> wrote:
> > Hi Python Experts:
> > There are two network interfaces on my laptop, one is
> > 100M Ethernet interface, the other is wifi interface, both are connected
> and
> > has an IP address. then the question is: how to get the ip address of the
> > wifi interface in a python script?
> > OS: Windows or Linux
>
> Detect the OS with os.name and branch out to specific use case.
>
> The specific functionality can be implemented 2 ways:
> 1/ Regular expression pattern match
> 2/ Substring match and splits
>
> The subprocess module will then let you run those commands.
> 1/ posix - (Linux in your case) will use ifconfig
> 2/ nt - (windows in your ase) will use ipconfig.
>
> HTH.
>
>
>
> --
>
> Regards
> Ishwor Gurung
> Key id:0xa98db35e
> Key fingerprint:FBEF 0D69 6DE1 C72B A5A8  35FE 5A9B F3BB 4E5E 17B5
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110514/2f5499b0/attachment-0001.html>


More information about the Python-list mailing list