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

MicroPython/ESP32-C3 + 1.8" 128x160 TFT ST7735 SPI, using boochow/MicroPython-ST7735 library.

CameraWebServe: ESP32-S3 (arduino-esp32) + OV5640 camera module