[python] How to output to the console and file?