Accessing the printed output of a function call
Part of my script is calling a function from (let's call it foo
) another module (written long ago by someone else and I don't want to change it now). foo
writes interesting things to stdout
(but returns None
), in part by calling other functions. I want to access these interesting things that I foo
write to stdout
.
As far as I know, it is subprocess
designed to invoke commands that I would normally call from the command line. Is there an equivalent for python functions that I would call from my script?
I'm on python2.7 if it matters
source to share