获取mac地址方法

1、打开PowerShell(win + x)输入Get-NetAdapter

2、打开 命令提示符,输入getmac -v

def get_mac_1():
    '''获取MAC地址'''
    address_list = []
    print(net_if_addrs())
    for k, v in net_if_addrs().items():
        for item in v:
            address = item[1]
            if '-' in address and len(address) == 17:
                address_list.append(address.replace('-', ':'))
    return address_list

你可能感兴趣的:(网络)