結果 : how to save terminal output to a file in python