On 15/05/2011 12:04 PM, Neal Becker wrote:
Far.Runner 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.
The question is: How to get the ip address of the wifi interface in a python
script without parsing the output of a shell command like "ipconfig" or
"ifconfig"?
OS: Windows or Linux
F.R
Here's some useful snippits for linux:
... and for Windows:
<code>
import wmi
for nic in wmi.WMI ().Win32_NetworkAdapterConfiguration (IPEnabled=1):
print nic.Caption, nic.IPAddress
</code>
TJG
--
http://mail.python.org/mailman/listinfo/python-list