結果 : python code to write output to a text file