如何为 subprocess.Popen 按顺序导入两个输入

How to import two inputs in sequence for subprocess.Popen

.exe需要按顺序输入两个如:

  1. what is your input 1: File1
  2. what is your input 2: File2

然后会运行。我正在尝试使用

p = subprocess.Popen([.exe, File1], cwd=filename_dir, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
time.sleep(1)
p.communicate(input=File2)

它不起作用,有什么帮助吗?

问题已解决,感谢@be_good_do_good和
计算器。com/a/165662/5334188

p = subprocess.Popen([analyzer, filename1], cwd=filename_dir,        stdin=subprocess.PIPE, stdout=subprocess.PIPE)
time.sleep(1)

m=p.communicate(input=b'filename1\nfilename2\n')[0]