How to make a python loop that would run a c program many times? : I have a c program that I can use from the terminal but i would like to run it many times in a loop in python. Someone told me to use the subprocess.call function but I have some trouble understanding how that works. 

From the terminal I usually run exactly this ```./grezza_foresta -w /Users/stordd/Desktop/StageI2M/Leiden/text_file/USA.g" -m 5 -e 0 > file_name.g ``` (the -w -m -e are option and the > is to create a file with the output)

So I tried something like that from what I've been told to do .



```
import subprocess
subprocess.call(["g++", "/Users/stordd/Desktop/StageI2M/C/forestenostre/grezza_foresta"])
ntrial = input("How many trials? ")
for i in range(int(ntrial)):
    tmp=subprocess.call("/Users/stordd/Desktop/StageI2M/C/forestenostre/grezza_foresta")
    print(i,tmp)
```

I'm getting these error : ```ld: warning: ignoring file /Users/stordd/Desktop/StageI2M/Leiden/text_file/USA.g, file was built for unsupported file format ( 0x6E 0x75 0x6D 0x65 0x72 0x6F 0x5F 0x64 0x69 0x5F 0x76 0x65 0x72 0x74 0x69 0x63 ) which is not the architecture being linked (x86_64): /Users/stordd/Desktop/StageI2M/Leiden/text_file/USA.g
How many trials? ld: can't link with a main executable file '/Users/stordd/Desktop/StageI2M/C/forestenostre/grezza_foresta' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)``` 

It actually seems to be working in some way but I don't know how to add the options.