regex - Increase / Decrease Mac Address in Python from String -
i have mac address in string form. interested in taking mac string , increasing / decreasing 1 value while keeping integrity of hex in python
ex: 000000001f
-1: 000000001e +1: 0000000020
parse it, change it, print it!
def change_mac(mac, offset) return "{:012x}".format(int(mac, 16) + offset)
Comments
Post a Comment