I've got an .exe which prompts the user for input at the command line interface for several numerical parameters and then generates data in a .txt. I would like to use Python in order to run the .exe repeatedly with different numerical parameters.
In Python, I've called the executable with:
subprocess.call(["executable.exe"])
How can I run the executable and specify input parameters (note: I am not referring to miscellaneous parameters such as -s, -t, etc but actual numerical parameters which are fed into the .exe)?
Thanks
EDIT: My .exe was created from a .cpp which doubles a integer given by the user when prompted at CLI.
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main() {
int ExampleNumber;
cout << "Please enter a number: ";
cin >> ExampleNumber;
ExampleNumber = ExampleNumber*2;
ofstream ExampleFile;
ExampleFile.open("ExampleFile.txt");
ExampleFile << ExampleNumber;
ExampleFile.close();
}
I tried running the .py with the an input of '3' as an example but it does not seem to be working still?
import subprocess
subprocess.call(["Executable.exe", '3'])