Skip to main content

convert mac to required format

Project description

Get mac address, correct and return in required format DOES NOT CHECK THE INPUT MAC ADDRESS FORMAT, just delete invalid characters and check len = 12 :param mac: mac address :param delimiter: separator character :param chunk: the number of characters before the separator output, mast be in [1, 2, 3, 4, 6]. 0 or None for output without delimiter :param capital: lowercase or uppercase return output str. default lowercase :return: mac address in required format

example: print(mac_4mater(‘ab.bg.55.55.55.53’, delimiter=’.’, chunk=4, capital=False)) ValueError: Invalid mac address ab.bg.55.55.55.53

print(mac_4mater(‘ab.bc.55.55.55.53’, delimiter=’.’, chunk=4)) abbc.5555.5553

print(mac_4mater(‘ab.bc55.55.55bbbbbbbbbbbbbb.53’, delimiter=’:’, chunk=4, capital=False)) ValueError: Invalid mac address ab.bc55.55.55bbbbbbbbbbbbbb.53

print(mac_4mater(‘ABrrrrrrrrrrrr.bc.55.55.55.53’, delimiter=’-’, chunk=2, capital=True)) AB-BC-55-55-55-53

print(mac_4mater(‘AB.bc.55.55.55.53’, delimiter=’:’, chunk=2, capital=True)) AB:BC:55:55:55:53

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mac-4mater-1.0.tar.gz (1.8 kB view hashes)

Uploaded Source

Built Distribution

mac_4mater-1.0-py3-none-any.whl (2.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page