如果输入的内容不取决于先前的答案,则可以使用
.communicate()以下命令一次全部传递它们:
import osfrom subprocess import Popen, PIPEp = Popen('fortranExecutable', stdin=PIPE) #NOTE: no shell=True herep.communicate(os.linesep.join(["input 1", "input 2"])).communicate()等待进程终止,因此您最多可以调用一次。



