import random def random_mac(): # 生成六组两位的十六进制数 return ":".join(["%02x" % random.randint(0, 255) for _ in range(6)]) # 生成MAC地址 mac_address = random_mac() print(mac_address)