Okay. I have completed my first python program.It has around 1000 lines of code. During development I placed plenty of print statements before running a command
print
Putting your own file-like in sys.stdout will let you capture the text output via print.
sys.stdout