I've not had any luck in figuring out how to do this:
In ipython, if I execute the following command
var = 'abc'
!echo $var | rev
it works as expected. But, how to capture the output of the shell command back to a variable in python (like new_var = !echo $"var" | rev
)?
I've tried most of the examples here Running shell command and capturing the output with no luck, since the variable var
isn't working as expected when passed to any of the many solutions using the subprocess library.