hostid?

Lance lbrannma at cablespeed.com
Sun Oct 20 01:24:22 CEST 2002


Thanks all for your advice. Magnus Lycka provided the solution, for Windows
XP:

If you by MacID mean MAC address, or Media Access Control
address, i.e. the hardware address in the network card,
this could work on Win 2000 for instance. The solution on
unix/linux is very similar. Please note that some machines
have several network cards (or none) which makes life more
difficult.

 >>> import os, re
 >>> pattern = re.compile(r'\w\w-\w\w-\w\w-\w\w-w\w-\w\w')
 >>> text = os.popen('ipconfig /all').read()
 >>> m = pattern.search(text)
 >>> m.group(0)
'00-01-02-E0-FF-FF


"Lance" <lbrannma at cablespeed.com> wrote in message
news:ur2ok51jlan72f at corp.supernews.com...
> Hi All,
>
> I'd like to retrieve a computer's hostid. Does anyone know how to do this?
>
> Thanks in advance.
>
> Lance
>
>





More information about the Python-list mailing list