Python。从 6 字节字符串中打印 mac 地址

标签 python printing tcp

我有 6 字节字符串的 mac 地址。您将如何以“人类”可读的格式打印它?

谢谢

最佳答案

import struct
"%x:%x:%x:%x:%x:%x" % struct.unpack("BBBBBB",your_variable_with_mac)

关于Python。从 6 字节字符串中打印 mac 地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4959741/

相关文章:

python - 使用 Tensorflow 2.0 的神经网络中的条件参数

python - blender : Create custom physics via scripts

websocket - 德尔福10.4 : Indy TIdTCPClient Reading Data from websocket and webserver

tcp - Golang 1.5 io.Copy 用两个 TCPConn 阻塞

linux - TCP 消息框架 + recv() [linux] : Good conventions?

python - 在函数内附加列表

python - Selenium for Python : Get text() of node that is shared with another element, 通过 XPath

cocoa - 如何以编程方式为 mac 应用程序设置打印选项的页面布局

c# - 系统.绘图.打印 : The RPC server is unavailable

javascript - Chrome 打印对话框在取消或打印对话框之前不会执行单独的 JavaScript 函数