Last active
November 10, 2021 22:32
-
-
Save david-lev/f4cc8544422a39c704dd6fb4e10bec69 to your computer and use it in GitHub Desktop.
Convert mac-address to device id
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
chars = { | |
"0": "00", | |
"1": "01", | |
"2": "02", | |
"3": "03", | |
"4": "04", | |
"5": "05", | |
"6": "06", | |
"7": "07", | |
"8": "08", | |
"9": "09", | |
"A": "10", | |
"B": "11", | |
"C": "12", | |
"D": "13", | |
"E": "14", | |
"F": "15" | |
} | |
def convert(mac_addr: str) -> str: | |
device_id = str() | |
for char in mac_addr.upper(): | |
if chars.get(char): | |
device_id += chars.get(char) | |
else: | |
device_id += char | |
return device_id | |
print(convert(input("Please enter your mac address: "))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment