with open('file1.txt', 'r') as file1, open('file2.txt', 'r') as file2, open('output.txt', 'w') as output:
data1 = file1.read()
data2 = file2.read()
output.write(data1 + '\n' + data2)
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
with open('file1.txt', 'r') as file1, open('file2.txt', 'r') as file2, open('output.txt', 'w') as output:
data1 = file1.read()
data2 = file2.read()
output.write(data1 + '\n' + data2)