---
# System prepended metadata

title: '[PYTHON] 取得設備mac address'
tags: [python]

---

```py=
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket
import uuid

def get_mac_address():
    macaddr = uuid.UUID(int = uuid.getnode()).hex[-12:]
    return ":".join([macaddr[i:i+2] for i in range(0,11,2)])

print(get_mac_address())
```