SyntaxFix
Write A Post
Hire A Developer
Questions
What you really want is logging module from standard library. Create a logger and attach two handlers, one would be writing to a file and the other to stdout or stderr.
logging
See Logging to multiple destinations for details