Equivalent of Backticks in Python

Posted by Chris Bunch on Stack Overflow See other posts from Stack Overflow or by Chris Bunch
Published on 2009-09-11T13:47:53Z Indexed on 2010/04/13 3:03 UTC
Read the original article Hit count: 245

Filed under:
|

What is the equivalent of the backticks found in Ruby and Perl in Python? That is, in Ruby I can do this:

foo = `cat /tmp/baz`

What does the equivalent statement look like in Python? I've tried os.system("cat /tmp/baz") but that puts the result to standard out and returns to me the error code of that operation.

© Stack Overflow or respective owner

Related posts about python

Related posts about backticks