Python code to get MAC address using uuid.getnode()
getMAC.py, Python code to get MAC address using uuid.getnode().
Run on Raspberry Pi 5/Raspberry Pi OS 64-bit (bookworm).
import re, uuid
node = uuid.getnode()
print("uuid.getnode():\t", node)
print("node(hex):\t", hex(node))
MACaddr = ":".join(re.findall('..', '%012X' % uuid.getnode()))
print("MAC addr\t", MACaddr)
Run on Raspberry Pi 5/Raspberry Pi OS 64-bit (bookworm).
Comments
Post a Comment