Aug-07-2017, 02:17 PM
You can capture and store the output in a variable by pointing sys.stdout to the variable and executing your command.
eg->
eg->
o_variable = StringIO() # variable to store stdout stream sys.stdout = o_variable # pointing stdout to variable #Execute your commands sys.stdout = sys.__stdout__ #restore std out output = o_variable.getvalue() print(output)