python mac地址转int_为什么用python获取mac地址会变动?

展开全部

首先声明,我本人62616964757a686964616fe4b893e5b19e31333436323164还没有研究出来问题的究竟。此处只是写下我本人的一点小心得,大家一起进步。

因为我发现,使用uuid库得到的mac地址,总有最后一位不对。所以,我就查看了python官方的uuid文档,找到了问题的关键是调用UUID()的时候,会调用getnode()函数以得到物理地址。

这个是getnode()函数的定义:

9d9d63ec5e91a04725f319c10aaad475.png

我把它摘出来,考到下面。

def getnode(*, getters=None):

"""Get the hardware address as a 48-bit positive integer.

The first time this runs, it may launch a separate program, which could

be quite slow.  If all attempts to obtain the hardware address fail, we

choose a random 48-bit number with its eighth bit set to 1 as recommended

in RFC 4122.

"""

global _node

if _node is not None:

retu

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值