I have written the following script to concatenate all the files in the directory into one single file.
Can this be optimized, in terms of
idiomat
You can iterate over the lines of a file object directly, without reading the whole thing into memory:
with open(fname, 'r') as readfile: for line in readfile: outfile.write(line)