How to get Mac address of ethernet port?

Skip Montanaro skip at pobox.com
Sat Jan 11 10:03:04 EST 2014


This is slightly longer than ChrisA's second solution:

>>> import uuid
>>> s = "%12x" % uuid.getnode()
>>> ":".join(x+y for x, y in zip(s[::2], s[1::2]))
'18:03:73:cb:2a:ee'

Skip



More information about the Python-list mailing list