#!/usr/bin/env python
#-*- coding:utf-8 -*- 

''' 给一个MAC地址加1 '''

mac = '52:54:00:e6:b2:0a'
prefix_mac = mac[:-2]

last_two = mac.split(':')[-1].lower()
new_last_two = int(last_two, 16) + 1
new_last_two = hex(new_last_two).split('x')[-1]
if len(str(new_last_two)) == 1:
    new_last_two = '0' + new_last_two
new_mac = prefix_mac + new_last_two

print(new_mac)

 

 

 

 

 

    

相关文章:

  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-24
  • 2021-10-25
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2021-11-09
  • 2021-12-26
  • 2021-12-26
  • 2021-08-23
相关资源
相似解决方案