結果 : python code to write output to a file