python-day001获取mac地址

# -*- coding: utf-8 -*-
import uuid

def get_mac_address():
    address = hex(uuid.getnode())[2:]
    mac = '-'.join(address[i:i + 2] for i in range(0, len(address), 2))
    print(mac)
    return mac

if __name__ == '__main__':
    print('main')
    get_mac_address()

posted @ 2021-11-05 21:30  浅笑若风  阅读(52)  评论(0编辑  收藏  举报