I want to get the mac from a device, I'm importing:
from uuid import getnode as get_mac
mac = get_mac()
print ('mac...>>>:',mac)
However, it brings digits that do not correspond to a MAC (00: 00: 00: 00: 00: 00)
I want to get the mac from a device, I'm importing:
from uuid import getnode as get_mac
mac = get_mac()
print ('mac...>>>:',mac)
However, it brings digits that do not correspond to a MAC (00: 00: 00: 00: 00: 00)
To get your MAC address as you want, you just need to do something extra, leaving your code like this:
from uuid import getnode as get_mac
mac = get_mac()
mac = ':'.join(("%012X" % mac)[i:i+2] for i in range(0, 12, 2))
print ('MAC >>>: ', mac)
Basically what you do is convert that number that returns to hexadecimal and separate it from 2 in two by adding the corresponding :