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

Drive 320x240 ILI9341 SPI TFT using ESP32-S3 (NodeMCU ESP-S3-12K-Kit) using TFT_eSPI library, in Arduino Framework.