Get IP address of WIFI interface
Ishwor Gurung
ishwor.gurung at gmail.com
Sat May 14 01:41:05 EDT 2011
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
More information about the Python-list
mailing list