Thanks BlackRabbit, but when I run the code I just see the cmd flashing and then nothing happens. It has to read something from the cmd, is this possible ? So for example: When I run the code it gives me as output my IPv4-address. Is this possible or do I need to use something else for this ? Thanks !
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
How to make code run differently depending on the platform it is running on?
xarzu - Apr 05 2019 09:17 AM
How do I set a breakpoint in an attached process in visual studio
xarzu - Apr 04 2019 11:47 AM
Recent Blog Entries
Recent Status Updates
- Managed C++
- Visual Basic 4 / 5 / 6
- linked list
- hello world
Posted 09 October 2014 - 01:18 PM
You'll probably want to use check_output function in subprocess module.
import subprocess subprocess.check_output(['ipconfig'])
You'll need to parse output.
# regex magic re.findall("IPv4 Address.*?:(.*?)\\r\\n", subprocess.check_output(['ipconfig'])) # split by line for line in subprocess.check_output(['ipconfig']).split("\r\n"): print line
Edited by Flying Dutchman, 09 October 2014 - 01:24 PM.
The roots of education are bitter, but the fruit is sweet.