Using Python to run executable and fill in user input
If the input doesn't depend on the previous answers then you could pass them all at once using .communicate()
:
import os
from subprocess import Popen, PIPE
p = Popen('fortranExecutable', stdin=PIPE) #NOTE: no shell=True here
p.communicate(os.linesep.join(["input 1", "input 2"]))
.communicate()
waits for process to terminate therefore you may call it at most once.