I wanted to combine two .txt files into another self-generated .txt file
Example:-
Contents of File 1
abcdefg
Contents of file 2
123456
Self-generated .txt File in the output folder
abcdefg
123456
filenames = [fname1, fname2, fname3]
with open('H:\output\output.txt', 'w') as outfile:
for fname in filenames:
with open(fname) as infile:
for line in infile:
outfile.write(line)
i use this code where it can combine both and write the output but the problem is it is not auto-generated file, we have to personally create an output file