How to get Mac address of ethernet port?
James Harris
james.harris.1 at gmail.com
Sat Jan 11 10:54:12 EST 2014
"Andriy Kornatskyy" <andriy.kornatskyy at live.com> wrote in message
news:mailman.5329.1389450993.18130.python-list at python.org...
> Sam,
>
> How about this?
>
> from uuid import getnode as get_mac
> '%012x' % get_mac()
AIUI that will return a mac address even if there isn't one. That may or may
not suit the OP.
To the OP, depending on what you want to do remember that a machine can have
more than one mac address and that a mac address can differ from the
burned-in address (BIA) as some cards allow the effective mac address to be
changed in software. So it's possible that two machines could show the same
mac address.
James
More information about the Python-list
mailing list