How do I retrieve program output in Python?

Posted by Geoff on Stack Overflow See other posts from Stack Overflow or by Geoff
Published on 2010-05-10T16:00:51Z Indexed on 2010/05/10 16:04 UTC
Read the original article Hit count: 345

Filed under:
|
|
|

I'm not a Perl user, but from this question deduced that it's exceedingly easy to retrieve the standard output of a program executed through a Perl script using something akin to:

$version = `java -version`;  

How would I go about getting the same end result in Python? Does the above line retrieve standard error (equivalent to C++ std::cerr) and standard log (std::clog) output as well? If not, how can I retrieve those output streams as well?

Thanks, Geoff

© Stack Overflow or respective owner

Related posts about python

Related posts about perl