I have been trying to combine the data from two seperate text files into a new text file. The code works OK and no errors are produced, but at the join between the two files, a few lines of data are left out. The same happens at the end of the last file input too. Does anyone have any ideas what could be causing this please?
I have attached my code
a = r'C:\Documents and Settings\Matt\Desktop\Hourly Rainfall Data\organised_data\25514_1990.txt' b = r'C:\Documents and Settings\Matt\Desktop\Hourly Rainfall Data\organised_data\25514_1991.txt' destination = r'C:\Documents and Settings\Matt\Desktop\Hourly Rainfall Data\organised_data\test_merge\25514.txt' open_destination_write = open(destination, 'w') open_destination_append = open(destination, 'a') print open_destination_write print open_destination_append for line in open(a).read(): open_destination_write.write(line) open_destination_write.close for line in open(b).read(): open_destination_append.write(line) open_destination_write.close