I wanted to ask if there is a way to run the commands of a command line program in python, but the codes must be executed repeatedly, namely, the solution I want is not this
os.system(f"xxx.exe {command}").
I tried subprocess.run function putting the name of the exe followed by the commands I want to execute inside the brackets and then these keyword args: stdout=subprocess.PIPE,text=True
however, oddly it doesn't make data.stdout
the whole output for some reason. Only the initial code's output is assigned to that. It is probably because the arguments inside the brackets don't represent different lines. Therefore, I guess the thing I've done using subprocess is the same as how I executed a single line of command via the os library.
Namely, my question is using subprocess or os, how can I execute codes that must be executed in different lines, or if not possible, how to execute commands from a command-line program one after another in python?
Edit: Should I make something like this?
os.system(f"xxx.exe {command1} \n {command2}")