Python论坛  - 讨论区

标题:[python-chinese] 如何得到网卡的mac地址

2007年11月27日 星期二 22:39

边 江 borderj在gmail.com
星期二 十一月 27 22:39:02 HKT 2007

winXP Python2.5

C:\Documents and Settings\border>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import uuid
>>> node = uuid.getnode()
>>> mac = uuid.UUID(int=node)
>>> addr = mac.hex[-12:]
>>> addr
'001e371a3dea'
>>>



On Nov 27, 2007 6:33 PM, 篱笆 <nameliba在gmail.com> wrote:

> 我的fc下用的是2.4版本
>
> 2007/11/27, Jiahua Huang <jhuangjiahua在gmail.com>:
>
> > 好像不能?
> >
> > huahua在huahua:~$ python
> > Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
> > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> import uuid
> > >>> uuid.uuid4()
> > UUID('eec21c44-32ea-41bc-9548-24aa1da7f618')
> > >>> uuid.uuid4()
> > UUID('d319e43e-11ce-4487-8dcb-36cb62b4c3d4')
> > >>>
> >
> >
> > On Nov 27, 2007 1:59 PM, 篱笆 <nameliba在gmail.com> wrote:
> > > 我也想知道uuid这块主要是用来处理什么的.
> > > 2003下import uuid正常
> > > linux 下好像不能 import uuid
> > > 会报错.
> >
>
-- 
Blog:    www.borderj.cn

 Border
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20071127/46445a7b/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月30日 星期五 20:12

eho eho jiulang.eho在gmail.com
星期五 十一月 30 20:12:00 HKT 2007

ÔÚ¼ÆËãuuid¹ý³ÌÖлáÓõ½macµØÖ·
µ«ÊÇÔÚÕâÀÓÃuuidÈ¡µÃmacµØÖ·(òËÆÊÇÕâÑùµÄ)£¬Ã»Àí½â


ÔÚ07-11-27£¬±ß ½­ <borderj在gmail.com> дµÀ£º
>
> winXP Python2.5
>
> C:\Documents and Settings\border>python
> Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
> (Intel)] on
> win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import uuid
> >>> node = uuid.getnode()
> >>> mac = uuid.UUID(int=node)
> >>> addr = mac.hex[-12:]
> >>> addr
> '001e371a3dea'
> >>>
>
>
>
> On Nov 27, 2007 6:33 PM, Àé°Ê <nameliba在gmail.com> wrote:
>
> > ÎÒµÄfcÏÂÓõÄÊÇ2.4°æ±¾
> >
> > 2007/11/27, Jiahua Huang <jhuangjiahua在gmail.com>:
> >
> > > ºÃÏñ²»ÄÜ£¿
> > >
> > > huahua在huahua:~$ python
> > > Python 2.5.1 (r251:54863, Oct  5 2007, 13:36:32)
> > > [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
> > > Type "help", "copyright", "credits" or "license" for more information.
> > > >>> import uuid
> > > >>> uuid.uuid4()
> > > UUID('eec21c44-32ea-41bc-9548-24aa1da7f618')
> > > >>> uuid.uuid4()
> > > UUID('d319e43e-11ce-4487-8dcb-36cb62b4c3d4')
> > > >>>
> > >
> > >
> > > On Nov 27, 2007 1:59 PM, Àé°Ê <nameliba在gmail.com> wrote:
> > > > ÎÒÒ²ÏëÖªµÀuuidÕâ¿éÖ÷ÒªÊÇÓÃÀ´´¦ÀíʲôµÄ£®
> > > > 2003ÏÂimport uuidÕý³£
> > > > linux ϺÃÏñ²»ÄÜ import uuid
> > > > »á±¨´í£®
> > >
> >
> --
> Blog:    www.borderj.cn
>
>  Border
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071130/bedb4193/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号