RE - Parsing ipconfig /all output - question

joblack johannes.black at gmail.com
Sun Jun 6 23:47:31 EDT 2010


I'm trying to get the first MAC address from the ipconfig /all output.
Unfortunately you can't just search for Physical Address because the
name is only valid in the English Windows version.

Here a test which isn't working:

import subprocess
import re
p = subprocess.Popen('ipconfig /all', shell = True, stdout
=subprocess.PIPE)
p.wait()
rawtxt = p.stdout.read()
print rawtxt
p = re.findall(r'(%X%X-){5}%X%X',rawtxt)
print p

Any ideas?



More information about the Python-list mailing list