3

I have a mac address in string form. I am interested in taking the Mac string and increasing / decreasing it by 1 value while keeping the integrity of Hex in Python

Ex: 000000001F

-1: 000000001E +1: 0000000020

4

1 回答 1

10

解析它,改变它,打印它!

def change_mac(mac, offset)
    return "{:012X}".format(int(mac, 16) + offset)
于 2013-08-09T20:14:48.867 回答