What\'s the best way to validate that an MAC address entered by the user?
The format is HH:HH:HH:HH:HH:HH, where each H is a hexadecimal ch
HH:HH:HH:HH:HH:HH
H
This works like a charm.
def isMAC48Address(inputString): if inputString.count(":")!=5: return False for i in inputString.split(":"): for j in i: if j>"F" or (j<"A" and not j.isdigit()) or len(i)!=2: return False return True