标签:class 练习 env code style mac地址 usr pytho last
#!/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)
标签:class 练习 env code style mac地址 usr pytho last
原文地址:https://www.cnblogs.com/pzk7788/p/10255578.html