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.
output = os.popen('cat /tmp/baz').read()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With