Last active
August 29, 2015 14:08
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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