python - Getting MAC Address -


i need cross platform method of determining mac address of computer @ run time. windows 'wmi' module can used , method under linux find run ifconfig , run regex across output. don't using package works on 1 os, , parsing output of program doesn't seem elegant not mention error prone.

does know cross platform method (windows , linux) method mac address? if not, know more elegant methods listed above?

python 2.5 includes uuid implementation (in @ least 1 version) needs mac address. can import mac finding function own code easily:

from uuid import getnode get_mac mac = get_mac() 

the return value mac address 48 bit integer.


Popular posts from this blog