Thanks, is there any other way without using external command? On Fri, May 13, 2011 at 10:41 PM, Ishwor Gurung <ishwor.gur...@gmail.com>wrote:
> Hi. > > On 14 May 2011 14:46, Far.Runner <far.run...@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 >
-- http://mail.python.org/mailman/listinfo/python-list