【发布时间】:2016-10-13 17:44:52
【问题描述】:
我有这个 python 代码
input()
print('spam')
另存为ex1.py
在交互式外壳中
>>>from subprocess import Popen ,PIPE
>>>a=Popen(['python.exe','ex1.py'],stdout=PIPE,stdin=PIPE)
>>> a.communicate()
(b'', None)
>>>
为什么不打印spam
【问题讨论】:
-
@Gator_Python 不,这些示例没有任何输入。
标签: python python-3.x subprocess