Re: Extract data from multiple text files

2018-05-15 Thread Cameron Simpson
On 15May2018 18:18, MRAB wrote: On 2018-05-15 13:12, mahesh d wrote: import glob,os [...] files = glob.glob(path) You've got a list of filenames here - they would work, _if_ you had passed in a glob pattern, instead of just the directory path. Try this again, joining "*.msg" or "*.txt" to

Re: Extract data from multiple text files

2018-05-15 Thread Albert-Jan Roskam
On May 15, 2018 14:12, mahesh d wrote: 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(f

Re: Extract data

2018-05-15 Thread Albert-Jan Roskam
On May 15, 2018 08:54, Steven D'Aprano wrote: On Tue, 15 May 2018 11:53:47 +0530, mahesh d wrote: > Hii. > > I have folder.in that folder some files .txt and some files .msg files. > . > My requirement is reading those file contents . Extract data in that > files . Reading .msg can be done

Re: Extract data from multiple text files

2018-05-15 Thread MRAB
On 2018-05-15 13:12, mahesh d wrote: 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(f

Re: Extract data from multiple text files

2018-05-15 Thread Rhodri James
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:

Re: Extract data

2018-05-14 Thread Steven D'Aprano
On Tue, 15 May 2018 11:53:47 +0530, mahesh d wrote: > Hii. > > I have folder.in that folder some files .txt and some files .msg files. > . > My requirement is reading those file contents . Extract data in that > files . The answer to this question is the same as the answer to your previous qu