How to get my MAC address with python ?

Josiah Carlson jcarlson at nospam.uci.edu
Mon Feb 2 17:14:47 EST 2004


Rick Holbert wrote:

> olivier Ravard wrote:
> 
> 
>>Hi,
>>
>>I want to know the MAC address of my local network card with a python
>>script.
>>I tested the socket module which gives only the IP address.
>>Is someone have an idea ?
> 
> 
> Here's a url where Mark Hammond explains how to do it on Windows:
> 
> http://groups.google.com/groups?oi=djq&selm=an_603363272
> 
> On Linux you can parse the output of the ifconfig command as described in
> following url:
> 
> http://mail.python.org/pipermail/python-list/1999-August/008816.html

It is also arbitrarily trivial to parse the output of ipconfig /all in 
Windows 2k/xp/2k3.  Windows 98/ME would be different.

  - Josiah




More information about the Python-list mailing list