Python几行代码打印出网卡的Mac地址
# coding=gbk
#你需要安装PyWin
'''
Created on 2011-5-7
@author: Yunanw
'''
import wmi
def main():
c = wmi.WMI()
adapterList = c.query("select * from Win32_NetworkAdapter where PhysicalAdapter = 'TRUE'")
for adapter in adapterList:
print adapter.MACAddress
if __name__ == '__main__':
main()
'''
Created on 2011-5-7
@author: Yunanw
'''
import wmi
def main():
c = wmi.WMI()
adapterList = c.query("select * from Win32_NetworkAdapter where PhysicalAdapter = 'TRUE'")
for adapter in adapterList:
print adapter.MACAddress
if __name__ == '__main__':
main()