我试图将子进程中的文本消息保存在一个变量中,但它们没有保存,也不再打印。有人能解释我为什么困惑吗:
import os
import subprocess
import sys
import re
locationOfFile='C:\\Users\\admin\\Desktop\\..........txt'
command="cmd"
subprocess.Popen(command)
process="mycommand"
command3=subprocess.Popen(process, stdout=subprocess.PIPE)
#Usially with this command in the child process I receave many messages, but with stdout I dont see them. I dont want to hide them from the console, just to go in that variable as a string "resultt"
resultt=command3.communicate()
print(resultt)
#But it is not printing?
目前没有回答
相关问题 更多 >
编程相关推荐