Skip to content

Instantly share code, notes, and snippets.

@mjseeley
Last active August 29, 2015 14:08
Show Gist options
  • Save mjseeley/f6deacc8cbb5f5dfb655 to your computer and use it in GitHub Desktop.
Save mjseeley/f6deacc8cbb5f5dfb655 to your computer and use it in GitHub Desktop.

Revisions

  1. mjseeley revised this gist Dec 3, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion decmactohexmac.py
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    # 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
  2. mjseeley created this gist Nov 6, 2014.
    8 changes: 8 additions & 0 deletions decmactohexmac.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@

    # 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