Python vertical txt concatenation not working properly
问题 There are two solutions from Concatenate tab-delimited txt files vertically Suppose input1 is X\tY input2 is A\tB\r\n C\t\r\n Here, A, B, C are ordinary words and \t is tab. If I run filenames = [input1, input2] with open(output, 'w') as outfile: for fname in filenames: with open(fname) as infile: outfile.write(infile.read().rstrip() + '\n') then I get X\tY\r\n A\tB\r\n C Suddenly \t after C disappears. If I run filenames = [input1, input2] with open(output, 'w') as outfile: for fname in