lads lads - 3 months ago 4x
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.


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.