我想要一个普通格式的MAC地址,我从get_node()获得。在
我得到的格式是0x0L0xdL0x60L0x76L0x31L0xd6L,我希望删除0x,并将L项转换为一个真正的十六进制数。应该是00-0D-60-76-31-D6。在
我怎么能意识到这一点?在
def getNetworkData (self):
myHostname, myIP, myMAC = AU.getHostname()
touple1 = (myMAC & 0xFF0000000000) >> 40
touple2 = (myMAC & 0x00FF00000000) >> 32
touple3 = (myMAC & 0x0000FF000000) >> 24
touple4 = (myMAC & 0x000000FF0000) >> 16
touple5 = (myMAC & 0x00000000FF00) >> 8
touple6 = (myMAC & 0x0000000000FF) >> 0
readableMACadress = hex(touple1) + hex(touple2) + hex(touple3) + hex(touple4) + hex(touple5) + hex(touple6)
print readableMACadress
return myHostname, myIP, readableMACadress
使用
更简单地说,您可以使用
^{pr2}$相关问题 更多 >
编程相关推荐