Python code to get MAC address using uuid.getnode()

getMAC.py, Python code to get MAC address using uuid.getnode().
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

Popular posts from this blog

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

my dev.tools - FNIRSI 2C23T 3-in-1 Dual Channel Oscilloscope/Multimeter/Signal Generator