I have a list of 20 file names, like [\'file1.txt\', \'file2.txt\', ...]. I want to write a Python script to concatenate these files into a new file. I could op
[\'file1.txt\', \'file2.txt\', ...]
I don't know about elegance, but this works:
import glob import os for f in glob.glob("file*.txt"): os.system("cat "+f+" >> OutFile.txt")