Perl-like backtick in Python

Tom Verbeure tom_verbeure at hotmail.com
Thu May 2 14:47:33 EDT 2002


Hi All,

In Perl i can do something like this:

$str = `cat myfile.in`;

Basically the string that is surrounded by the backticks is executed
by a shell and the stdout is returned as a string.

In the python library, there is spawn*, exec* and system, but the
return the exit status of the command, not the output. Any suggestions
about who to do this?

Thanks,
Tom



More information about the Python-list mailing list