当前位置:编程学习 > python >>

介绍python下wmi模块之二:得到本机的网卡类型和IP地址

这里还是要介绍python下面的wim这个模块,这次我们来介绍如何得到本机的网卡类型,ip和mac地址,代码如下:
 
#-*- encoding: utf-8 -*-  
    
 
Created on 2011-3-1  
 
@author: hack7th 
     
 
import wmi   
 
import time   
 
c = wmi.WMI()   
 
for inte易做图ce in c.Win32_NetworkAdapterConfiguration (IPEnabled=1):  
      print inte易做图ce.Description, inte易做图ce.MACAddress   
 
    for ip_address in inte易做图ce.IPAddress:   
 
        print ip_address 


#-*- encoding: utf-8 -*-
 

Created on 2011-3-1

@author: hack7th
 

import wmi

import time

c = wmi.WMI()

for inte易做图ce in c.Win32_NetworkAdapterConfiguration (IPEnabled=1):
      print inte易做图ce.Description, inte易做图ce.MACAddress

    for ip_address in inte易做图ce.IPAddress:

        print ip_address

补充:软件开发 , C语言 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,