Skip to content

Instantly share code, notes, and snippets.

@mjseeley
Last active August 29, 2015 14:08
Show Gist options
  • Save mjseeley/07f255fd5ae7ec3fb9b5 to your computer and use it in GitHub Desktop.
Save mjseeley/07f255fd5ae7ec3fb9b5 to your computer and use it in GitHub Desktop.
Convert hex MAC address to decimal MAC address (00AABBCCDDEE -> 123.123.123.123.123.123)
# Function/arguments: hexmactodecmac(hexmac)
# Description: Convert hex MAC address to decimal MAC address (00AABBCCDDEE -> 123.123.123.123.123.123)
# Returns: MAC address in dec format with delimiters(".")
def hexmactodecmac(hexmac):
hexmac = re.findall(r'.{1,2}', hexmac, re.DOTALL)
decmac = '.'.join(str(int(i, 16)).zfill(1) for i in hexmac)
return decmac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment