here is the code :
file_names = []
for i in range(1,201):
file_names.append("D:\\alllllllllllll files\\" + str(i) + ".txt")
#here alllllllllllll files is in a directory where all files are stored
#and number i which is in range 1,200 is concatenating with the file address
with open('output file location ', 'w') as outfile:
for fname in file_names:
with open(fname) as infile:
for line in infile:
outfile.write(line)
outfile.write('\n')
Suppose you have many files stored in a directory and these files are numbered sequentially like in the below image ->
 |
image of text files |
No comments:
Post a Comment