lads lads - 1 year ago 89
Python Question

Run a command from Windows from Python code

How can I run the following command from Python3 on Windows 7

gcc main.cpp -o main.out

The purpose is to execute the main.cpp file from Python3.

Answer Source

look subprocess call

import subprocess["gcc", "main.cpp -o main.out"])["./main.out"])

should work. But subprocess have more utilities that will be usefull for you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download