这是我的密码。
import subprocess
bashCommand = "./program -s file_to_read.txt | ./awk_program.txt"
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
output = process.communicate()[0]
output2 = process.stdout
print output
print output2
这个bash命令在终端中单独使用时打印awk_程序的输出(它只打印到stdout)。但是在python中,output什么都不打印,output2打印
<closed file '<fdopen>', mode 'rb' at 0x2b5b20>
我需要做什么才能返回输出?
目前没有回答
相关问题 更多 >
编程相关推荐