I want to make a program (Python 3.6) that can read multiple log files and write all the lines from those files into a txt file.
The code that I've already tried can read all the lines, but can't write all lines to a txt file. I've tried this:
allFiles = glob.glob('C:\Program Files\PostgreSQL\9.6\data\pg_log\*.log')
def readFile(allFiles):
    for file in allFiles:
        f = open(file,'r')
        allLines = []
        for line in f:
            allLines.append(line)
            print(line)
        f.close()
    with open ('readFile.txt',mode='wt', encoding='utf-8') as fileOutput:
        for line in allLines:
            fileOutput.write(line)
        fileoutput.close()
I expect all the lines from all files can written in a txt file, but results I've got was lines written in txt only line that have the same date as the date of execution of this program.
What should I do ?
 
     
     
    