I have multiple .TXT files in a folder. Each text file has the same outline of paragraphs out of which I wish to select everything between 2 specific words.
I have a regex code for finding the particular text of interest.
The aim is to write a python code that can extract the desired text from all the .txt files and place it in an excel sheet next to the name of the .TXT file

Recommended Answers

This is a common plea for either a finished app or homework. In either case we ask you to supply what you have so far in code and write what line or issue is stopping you.

If this is something you are hiring out then state so no one …

Jump to Post

All 2 Replies

This is a common plea for either a finished app or homework. In either case we ask you to supply what you have so far in code and write what line or issue is stopping you.

If this is something you are hiring out then state so no one misunderstands this is a job for hire.

So the path you need to take here is:

  1. Create an excel file stream

  2. Scan for all .txt files in a folder

  3. For each .txt file, retrieve its contents and then ...

    a. Use regex to retrieve the particular text of interest
    b. Append to the excel file stream

I don't know Python, but hopefully this helps you a bit. Good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.