python 根據uuid 獲取mac地址

import uuid

try:
    mac = uuid.UUID(int=uuid.getnode()).hex[-12:]
    mac_address = ':'.join([mac[e:e + 2] for e in range(0, 11, 2)])
except:
    mac_address = ''
print(mac_address)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章