Extract data from multiple text files
Rhodri James
rhodri at kynesim.co.uk
Tue May 15 08:23:35 EDT 2018
On 15/05/18 13:12, mahesh d wrote:
> import glob,os
> import errno
>
> path = 'C:/Users/A-7993\Desktop/task11/sample emails/'
> files = glob.glob(path)
>
> 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 .
What errors? Please cut and paste the traceback (don't retype it, and
definitely don't send us screenshots; attachments aren't allowed on the
mailing list).
--
Rhodri James *-* Kynesim Ltd
More information about the Python-list
mailing list