#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import string
import random
num=int(sys.argv[1])
#随机生成一个MAC地址
def creat_mac():
MAC=‘41-AF‘
hex_num=string.hexdigits
for i in range(4):
n=random.sample(hex_num,2)
sn=‘-‘+‘‘.join(n).upper()
MAC+=sn
return MAC
#随机生成n个
def creat_mac1():
with open(‘mac.txt‘,‘w‘)as f:
for i in range(num):
mac=creat_mac()
print(mac)
f.write(mac+‘\n‘)
creat_mac1()