Extract data
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue May 15 02:54:22 EDT 2018
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
question "Extract" sent earlier.
Use the glob module, or the os.listdir function, to get a list of files
matching the extension you want, then read each file.
Do you know how to open and read the contents of a file?
with open("filename.txt", "r"):
data = f.read()
What you do with the data is then up to you.
--
Steve
More information about the Python-list
mailing list