Skip to content

Instantly share code, notes, and snippets.

@guessi
Created February 2, 2017 14:51
Show Gist options
  • Save guessi/a04fd9b83678e1c2f12e89d8547d39a3 to your computer and use it in GitHub Desktop.
Save guessi/a04fd9b83678e1c2f12e89d8547d39a3 to your computer and use it in GitHub Desktop.
Get MAC address in Python
#!/usr/bin/env python
import uuid
macaddr_hex = uuid.UUID(int=uuid.getnode()).hex[-12:]
print(':'.join(macaddr_hex[i:i + 2] for i in range(0, 11, 2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment