for dir, dirs, files in os.walk('.'):
    for file in files:
        if fnmatch.fnmatch(file, '*.txt'):
            L = open(os.path.join(dir, file), 'r').read()
How to read all text file contents in a folder and copy those contents as rows into one excel file