nobody at nowhere.com
Tue Aug 16 13:26:39 CEST 2011
On Tue, 16 Aug 2011 02:03:50 -0500, Danny Wong (dannwong) wrote:
> I'm executing a command which I want to capture the
> standard/stderr output into a file (which I have with the code below),
> but I also want the standard output to go into a variable so I can
> process the information for the next command. Any ideas? Thanks.
> CMD_OUTPUT = subprocess.Popen(COMMAND, stdout=PROJECT_LOGFILE,
with open(PROJECT_LOGFILE,'r') as f:
str = f.read()
If you're going to be writing it to a file anyhow, reading that file is
likely to be faster than the alternatives.
More information about the Python-list