Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #5336
| References | <BANLkTi=d3W65RBqn96UFhZ_bkEz1Wh2Khg@mail.gmail.com> |
|---|---|
| Date | 2011-05-14 15:41 +1000 |
| Subject | Re: Get IP address of WIFI interface |
| From | Ishwor Gurung <ishwor.gurung@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1536.1305351667.9059.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Get IP address of WIFI interface Ishwor Gurung <ishwor.gurung@gmail.com> - 2011-05-14 15:41 +1000
csiph-web