Last active
August 29, 2015 14:08
-
-
Save mjseeley/f6deacc8cbb5f5dfb655 to your computer and use it in GitHub Desktop.
Convert Decimal MAC address to hex MAC address (123.123.123.123.123.123 -> 00AABBCCDDEE)
This file contains hidden or 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: decmactohexmac(decmac) | |
| # Description: Convert Decimal MAC address to hex MAC address (123.123.123.123.123.123 -> 00AABBCCDDEE) | |
| # Returns: MAC address in hex format without delimiters | |
| def decmactohexmac(decmac): # | |
| decmac = decmac.split(".") | |
| hexmac = ''.join(str(hex(int(i)).lstrip('0x')).zfill(2) for i in decmac).upper() | |
| return hexmac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment