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
Python lets you capture and assign sys.stdout - as mentioned - to do this:
import sys old_stdout = sys.stdout log_file = open("message.log","w") sys.stdout = log_file print "this will be written to message.log" sys.stdout = old_stdout log_file.close()