

Which might be one of several classes: > from macaddress import EUI48, EUI64, OUI > macaddress. There is also a parse function for when you have a string You can define a subclass and add the formats: > class MAC ( macaddress. If you need to parse in a format that isn’t supported, If the string does not match one of the formats, a “digit”, and all other characters are matched literally. formats ( 'xx-xx-xx', 'xx:xx:xx', 'xxxxxx' )Įach x in the format string matches one hexadecimal You can inspect what formats a hardware address class supportsīy looking at its formats attribute: > macaddress. Parse or Validate String When only one address type is valid:Īll provided classes support the standard and common formats.įor example, the EUI48 class supports the followingįormats: > macaddress. If those aren’t enough, you canĮasily define others with just a few lines of code. Types: EUI48 (also available as MAC), EUI64, Installation pip install macaddress UsageĬlasses are provided for the common hardware identifier This library’s version numbers follow the SemVer 2.0.0

Heavily inspired by the ipaddress module, but not yet quite Hardware identifier like an EUI-64, OUI, etc,Ĭonvert between string and binary forms of MAC addresses and A module for handling hardware identifiers like MAC addresses.Ĭheck if a string represents a valid MAC address, or a similar
