Search code examples
pythonprintingtcp

Python. Print mac address out of 6 byte string


I have mac address in 6 byte string. How would you print it in "human" readable format?

Thanks


Solution

  • import struct
    "%x:%x:%x:%x:%x:%x" % struct.unpack("BBBBBB",your_variable_with_mac)