macaddr
As a network engineer you many have to deal with MAC address values. In some cases a network operating system wants the MAC address in a particular format. The following are common formats:
* aa:bb:cc:dd:ee:ff
* aabb-ccdd-eeff
* aabb.ccdd.eeff
As well as their upper-case variants, AA:BB:CC:DD:EE:FF for example.
This package provides the MacAddress class definition and a supporting format
method that allows you to develop programs using a MAC address in different formats.
Installation
pip install macaddr
Usage
By default the MacAddress is formated in the "2 byte colon separated" format.
from macaddr import MacAddress
mac = MacAddress("aabb.ccdd.eeff")
print(mac)
aa:bb:cc:dd:ee:ff
You can obtain differnt formats using the format method.
from macaddr import MacAddress
mac = MacAddress("aabb.ccdd.eeff")
print(mac.format(size=4, sep='-', to_case=str.upper))
AABB-CCDD-EEFF
The format method values are cached so that repeated calls to format with
the same arguments return the cached value. For example, if you had a network
of 1000 devices, 500 of them required the "2-colon" format and 500 of them
required the "4-dot" format, then these two formats are only computed twice.
Release files for macaddr 2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| macaddr-2.1.tar.gz | 7.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| macaddr-2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.0 kB
Release files / macaddr-2.1.tar.gz
| Download URL | macaddr-2.1.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07bb34404774719284b336c8d920ec29a49c948e2351ed357d6ed64e2533ae90
|
|
BLAKE2b-256 checksum How to use checksums |
5cf9264e433ffd3046106be8fd953fc86237b87e7da9c5622bf7c188b9ffd66d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|
Release files / macaddr-2.1-py3-none-any.whl
| Download URL | macaddr-2.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
98ef79bf0b451114f76b7e329bbdd134a6b2ca63d6e5aae72f990ea2a33d80c3
|
|
BLAKE2b-256 checksum How to use checksums |
af0739cd975abb97f8bdcc68fd22dfc094db444946e7593976beb92bca8d11b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|