Possible Duplicate:
How do I duplicate sys.stdout to a log file in python?
Is it possible for Python print
command or other Python command to print a string to two destinations? For example, I would like to print both to the console and to output file in one statement (so that I don't need to duplicate print
statements).
Preferably, I'd like to have a solution for Python 2.x if that may matter.