Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5336 > unrolled thread

Re: Get IP address of WIFI interface

Started byIshwor Gurung <ishwor.gurung@gmail.com>
First post2011-05-14 15:41 +1000
Last post2011-05-14 15:41 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Get IP address of WIFI interface Ishwor Gurung <ishwor.gurung@gmail.com> - 2011-05-14 15:41 +1000

#5336 — Re: Get IP address of WIFI interface

FromIshwor Gurung <ishwor.gurung@gmail.com>
Date2011-05-14 15:41 +1000
SubjectRe: Get IP address of WIFI interface
Message-ID<mailman.1536.1305351667.9059.python-list@python.org>
Hi.

On 14 May 2011 14:46, Far.Runner <far.runner@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web