import glob,os import errno
path = 'C:/Users/A-7993\Desktop/task11/sample emails/' files = glob.glob(path) '''for name in files: print(str(name)) if name.endswith(".txt"): print(name)''' for file in os.listdir(path): print(file) if file.endswith(".txt"): print(os.path.join(path, file)) print(file) try: with open(file) as f: msg = f.read() print(msg) except IOError as exc: if exc.errno != errno.EISDIR: raise In the above program . Getting lot of errors . My intention is read the list of the text files in a folder . Print them How can resolve those error -- https://mail.python.org/mailman/listinfo/python-list